mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
Add support for plank 0.11 api
This commit is contained in:
parent
e72486e57f
commit
4e50b6639e
@ -181,6 +181,13 @@ if test "x$have_mutter318" = "xyes" ; then
|
||||
MUTTER_API="3.18"
|
||||
fi
|
||||
|
||||
# Check for newer Plank
|
||||
PLANK_PKGS="plank >= 0.10.9"
|
||||
PKG_CHECK_MODULES(PLANK_0_11, $PLANK_PKGS, [enable_plank_0_11=yes], [enable_plank_0_11=no])
|
||||
if test "x$enable_plank_0_11" = "xyes" ; then
|
||||
VALAFLAGS="$VALAFLAGS --define HAVE_PLANK_0_11"
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Dependencies for Notifications plugin
|
||||
# -----------------------------------------------------------
|
||||
|
@ -132,10 +132,18 @@ namespace Gala
|
||||
if (app != null && app.get_desktop_file () != null) {
|
||||
var appinfo = new DesktopAppInfo.from_filename (app.get_desktop_file ());
|
||||
if (appinfo != null) {
|
||||
#if HAVE_PLANK_0_11
|
||||
icon = Plank.DrawingService.get_icon_from_gicon (appinfo.get_icon ());
|
||||
#else
|
||||
icon = Plank.Drawing.DrawingService.get_icon_from_gicon (appinfo.get_icon ());
|
||||
#endif
|
||||
icon_key = "%s::%i".printf (icon, size);
|
||||
if (ignore_cache || (image = icon_pixbuf_cache.get (icon_key)) == null) {
|
||||
#if HAVE_PLANK_0_11
|
||||
image = Plank.DrawingService.load_icon (icon, size, size);
|
||||
#else
|
||||
image = Plank.Drawing.DrawingService.load_icon (icon, size, size);
|
||||
#endif
|
||||
not_cached = true;
|
||||
}
|
||||
}
|
||||
@ -166,7 +174,11 @@ namespace Gala
|
||||
}
|
||||
|
||||
if (size != image.width || size != image.height)
|
||||
#if HAVE_PLANK_0_11
|
||||
image = Plank.DrawingService.ar_scale (image, size, size);
|
||||
#else
|
||||
image = Plank.Drawing.DrawingService.ar_scale (image, size, size);
|
||||
#endif
|
||||
|
||||
if (not_cached)
|
||||
icon_pixbuf_cache.set (icon_key, image);
|
||||
|
@ -33,20 +33,35 @@ namespace Gala
|
||||
}
|
||||
|
||||
Plank.DockPreferences? dock_settings = null;
|
||||
#if HAVE_PLANK_0_11
|
||||
Plank.DockTheme? dock_theme = null;
|
||||
|
||||
public signal void dock_theme_changed (Plank.DockTheme? old_theme,
|
||||
Plank.DockTheme new_theme);
|
||||
#else
|
||||
Plank.Drawing.DockTheme? dock_theme = null;
|
||||
|
||||
public signal void dock_theme_changed (Plank.Drawing.DockTheme? old_theme,
|
||||
Plank.Drawing.DockTheme new_theme);
|
||||
#endif
|
||||
|
||||
DockThemeManager ()
|
||||
{
|
||||
#if HAVE_PLANK_0_11
|
||||
dock_settings = new Plank.DockPreferences ("dock1");
|
||||
#else
|
||||
var file = Environment.get_user_config_dir () + "/plank/dock1/settings";
|
||||
|
||||
dock_settings = new Plank.DockPreferences.with_filename (file);
|
||||
#endif
|
||||
dock_settings.notify["Theme"].connect (load_dock_theme);
|
||||
}
|
||||
|
||||
#if HAVE_PLANK_0_11
|
||||
public Plank.DockTheme get_dock_theme ()
|
||||
#else
|
||||
public Plank.Drawing.DockTheme get_dock_theme ()
|
||||
#endif
|
||||
{
|
||||
if (dock_theme == null)
|
||||
load_dock_theme ();
|
||||
@ -61,7 +76,11 @@ namespace Gala
|
||||
|
||||
void load_dock_theme ()
|
||||
{
|
||||
#if HAVE_PLANK_0_11
|
||||
var new_theme = new Plank.DockTheme (dock_settings.Theme);
|
||||
#else
|
||||
var new_theme = new Plank.Drawing.DockTheme (dock_settings.Theme);
|
||||
#endif
|
||||
new_theme.load ("dock");
|
||||
dock_theme_changed (dock_theme, new_theme);
|
||||
dock_theme = new_theme;
|
||||
|
@ -52,7 +52,11 @@ namespace Gala
|
||||
GLib.Environment.unset_variable ("NO_GAIL");
|
||||
GLib.Environment.unset_variable ("NO_AT_BRIDGE");
|
||||
|
||||
#if HAVE_PLANK_0_11
|
||||
Plank.Paths.initialize ("plank", Config.DATADIR + "/plank");
|
||||
#else
|
||||
Plank.Services.Paths.initialize ("plank", Config.DATADIR + "/plank");
|
||||
#endif
|
||||
|
||||
// Force initialization of static fields in Utils class
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=543189
|
||||
|
@ -33,8 +33,13 @@ namespace Gala
|
||||
|
||||
WindowActor? dock_window;
|
||||
Actor dock;
|
||||
#if HAVE_PLANK_0_11
|
||||
Plank.Surface? dock_surface;
|
||||
Plank.DockTheme dock_theme;
|
||||
#else
|
||||
Plank.Drawing.DockSurface? dock_surface;
|
||||
Plank.Drawing.DockTheme dock_theme;
|
||||
#endif
|
||||
Plank.DockPreferences dock_settings;
|
||||
float dock_y_offset;
|
||||
float dock_height_offset;
|
||||
@ -57,12 +62,20 @@ namespace Gala
|
||||
construct
|
||||
{
|
||||
// pull drawing methods from libplank
|
||||
#if HAVE_PLANK_0_11
|
||||
dock_settings = new Plank.DockPreferences ("dock1");
|
||||
#else
|
||||
var settings_file = Environment.get_user_config_dir () + "/plank/dock1/settings";
|
||||
dock_settings = new Plank.DockPreferences.with_filename (settings_file);
|
||||
#endif
|
||||
dock_settings.notify.connect (update_dock);
|
||||
dock_settings.notify["Theme"].connect (load_dock_theme);
|
||||
|
||||
#if HAVE_PLANK_0_11
|
||||
var launcher_folder = Plank.Paths.AppConfigFolder.get_child ("dock1").get_child ("launchers");
|
||||
#else
|
||||
var launcher_folder = Plank.Services.Paths.AppConfigFolder.get_child ("dock1").get_child ("launchers");
|
||||
#endif
|
||||
|
||||
if (launcher_folder.query_exists ()) {
|
||||
try {
|
||||
@ -111,7 +124,11 @@ namespace Gala
|
||||
if (dock_theme != null)
|
||||
dock_theme.notify.disconnect (update_dock);
|
||||
|
||||
#if HAVE_PLANK_0_11
|
||||
dock_theme = new Plank.DockTheme (dock_settings.Theme);
|
||||
#else
|
||||
dock_theme = new Plank.Drawing.DockTheme (dock_settings.Theme);
|
||||
#endif
|
||||
dock_theme.load ("dock");
|
||||
dock_theme.notify.connect (update_dock);
|
||||
|
||||
@ -203,7 +220,11 @@ namespace Gala
|
||||
}
|
||||
|
||||
if (dock_surface == null || dock_surface.Width != width || dock_surface.Height != height) {
|
||||
#if HAVE_PLANK_0_11
|
||||
var dummy_surface = new Plank.Surface.with_cairo_surface (1, 1, cr.get_target ());
|
||||
#else
|
||||
var dummy_surface = new Plank.Drawing.DockSurface.with_surface (1, 1, cr.get_target ());
|
||||
#endif
|
||||
|
||||
dock_surface = dock_theme.create_background (width, height, position, dummy_surface);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user