summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/wncklet/Makefile.am7
-rw-r--r--applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in14
-rw-r--r--applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in10
-rw-r--r--applets/wncklet/window-list.c53
-rw-r--r--applets/wncklet/window-list.ui2
-rw-r--r--configure.ac11
6 files changed, 65 insertions, 32 deletions
diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am
index 84682ee9..dc23143f 100644
--- a/applets/wncklet/Makefile.am
+++ b/applets/wncklet/Makefile.am
@@ -90,9 +90,16 @@ BUILT_SOURCES = \
wncklet-resources.c \
wncklet-resources.h
+if HAVE_WINDOW_PREVIEWS
wncklet_gschemas_in = \
org.mate.panel.applet.window-list.gschema.xml.in \
+ org.mate.panel.applet.window-list-previews.gschema.xml.in \
org.mate.panel.applet.workspace-switcher.gschema.xml.in
+else
+wncklet_gschemas_in = \
+ org.mate.panel.applet.window-list.gschema.xml.in \
+ org.mate.panel.applet.workspace-switcher.gschema.xml.in
+endif
gsettings_SCHEMAS = $(wncklet_gschemas_in:.xml.in=.xml)
@INTLTOOL_XML_NOMERGE_RULE@
diff --git a/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in b/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in
new file mode 100644
index 00000000..8f37281a
--- /dev/null
+++ b/applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml.in
@@ -0,0 +1,14 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.mate.panel.applet.window-list-previews">
+ <key name="show-window-thumbnails" type="b">
+ <default>true</default>
+ <summary>Display window thumbnails on hover</summary>
+ <description>If true, then when hovering over a taskbar item, a thumbnail of the window will appear. It will go away as soon as the mouse leaves the item.</description>
+ </key>
+ <key name="thumbnail-window-size" type="i">
+ <default>200</default>
+ <summary>Size of window thumbnails</summary>
+ <description>Size in pixels of the window preview thumbnail. The largest between width and height will use this value, the other one will be calculated to maintain the correct aspect ratio.</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in b/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in
index 08647c21..0f2d871d 100644
--- a/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in
+++ b/applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in
@@ -10,16 +10,6 @@
<summary>Show windows from all workspaces</summary>
<description>If true, the window list will show windows from all workspaces. Otherwise it will only display windows from the current workspace.</description>
</key>
- <key name="show-window-thumbnails" type="b">
- <default>true</default>
- <summary>Display window thumbnails on hover</summary>
- <description>If true, then when hovering over a taskbar item, a thumbnail of the window will appear. It will go away as soon as the mouse leaves the item.</description>
- </key>
- <key name="thumbnail-window-size" type="i">
- <default>200</default>
- <summary>Size of window thumbnails</summary>
- <description>Size in pixels of the window preview thumbnail. The largest between width and height will use this value, the other one will be calculated to maintain the correct aspect ratio.</description>
- </key>
<key name="group-windows" enum="org.mate.panel.applet.window-list.GroupingType">
<default>'never'</default>
<summary>When to group windows</summary>
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 581ed66b..207fc2e5 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -22,7 +22,7 @@
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
#include <gio/gio.h>
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
#include <gdk/gdkx.h>
#endif
@@ -34,11 +34,14 @@
#define WINDOW_LIST_ICON "mate-panel-window-list"
#define WINDOW_LIST_SCHEMA "org.mate.panel.applet.window-list"
+#ifdef HAVE_WINDOW_PREVIEWS
+#define WINDOW_LIST_PREVIEW_SCHEMA "org.mate.panel.applet.window-list-previews"
+#endif
typedef struct {
GtkWidget* applet;
GtkWidget* tasklist;
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
GtkWidget* preview;
gboolean show_window_thumbnails;
@@ -60,7 +63,7 @@ typedef struct {
GtkWidget* properties_dialog;
GtkWidget* show_current_radio;
GtkWidget* show_all_radio;
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
GtkWidget* show_thumbnails_radio;
GtkWidget* hide_thumbnails_radio;
GtkWidget* thumbnail_size_spin;
@@ -73,6 +76,9 @@ typedef struct {
GtkWidget* change_workspace_radio;
GSettings* settings;
+#ifdef HAVE_WINDOW_PREVIEWS
+ GSettings* preview_settings;
+#endif
} TasklistData;
static void call_system_monitor(GtkAction* action, TasklistData* tasklist);
@@ -152,7 +158,7 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac
}
}
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
static GdkPixbuf *preview_window_thumbnail (WnckWindow *wnck_window, TasklistData *tasklist)
{
GdkWindow *window;
@@ -407,7 +413,7 @@ static void display_all_workspaces_changed(GSettings* settings, gchar* key, Task
tasklist_properties_update_content_radio(tasklist);
}
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
static void tasklist_update_thumbnails_radio(TasklistData* tasklist)
{
GtkWidget* button;
@@ -534,12 +540,15 @@ static void setup_gsettings(TasklistData* tasklist)
"changed::display-all-workspaces",
G_CALLBACK (display_all_workspaces_changed),
tasklist);
-#if WNCK_CHECK_VERSION (3, 32, 0)
- g_signal_connect (tasklist->settings,
+
+#ifdef HAVE_WINDOW_PREVIEWS
+ tasklist->preview_settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (tasklist->applet), WINDOW_LIST_PREVIEW_SCHEMA);
+
+ g_signal_connect (tasklist->preview_settings,
"changed::show-window-thumbnails",
G_CALLBACK (window_thumbnails_changed),
tasklist);
- g_signal_connect (tasklist->settings,
+ g_signal_connect (tasklist->preview_settings,
"changed::thumbnail-window-size",
G_CALLBACK (thumbnail_size_changed),
tasklist);
@@ -662,10 +671,10 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings, "display-all-workspaces");
-#if WNCK_CHECK_VERSION (3, 32, 0)
- tasklist->show_window_thumbnails = g_settings_get_boolean (tasklist->settings, "show-window-thumbnails");
+#ifdef HAVE_WINDOW_PREVIEWS
+ tasklist->show_window_thumbnails = g_settings_get_boolean (tasklist->preview_settings, "show-window-thumbnails");
- tasklist->thumbnail_size = g_settings_get_int (tasklist->settings, "thumbnail-window-size");
+ tasklist->thumbnail_size = g_settings_get_int (tasklist->preview_settings, "thumbnail-window-size");
#endif
tasklist->grouping = g_settings_get_enum (tasklist->settings, "group-windows");
@@ -698,7 +707,7 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
wnck_tasklist_set_icon_loader(WNCK_TASKLIST(tasklist->tasklist), icon_loader_func, tasklist, NULL);
g_signal_connect(G_OBJECT(tasklist->tasklist), "destroy", G_CALLBACK(destroy_tasklist), tasklist);
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
g_signal_connect(G_OBJECT(tasklist->tasklist), "task_enter_notify", G_CALLBACK(applet_enter_notify_event), tasklist);
g_signal_connect(G_OBJECT(tasklist->tasklist), "task_leave_notify", G_CALLBACK(applet_leave_notify_event), tasklist);
#endif
@@ -835,15 +844,15 @@ static void group_windows_toggled(GtkToggleButton* button, TasklistData* tasklis
}
}
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
static void show_thumbnails_toggled(GtkToggleButton* button, TasklistData* tasklist)
{
- g_settings_set_boolean(tasklist->settings, "show-window-thumbnails", gtk_toggle_button_get_active(button));
+ g_settings_set_boolean(tasklist->preview_settings, "show-window-thumbnails", gtk_toggle_button_get_active(button));
}
static void thumbnail_size_spin_changed(GtkSpinButton* button, TasklistData* tasklist)
{
- g_settings_set_int(tasklist->settings, "thumbnail-window-size", gtk_spin_button_get_value_as_int(button));
+ g_settings_set_int(tasklist->preview_settings, "thumbnail-window-size", gtk_spin_button_get_value_as_int(button));
}
#endif
@@ -890,7 +899,7 @@ static void setup_sensitivity(TasklistData* tasklist, GtkBuilder* builder, const
static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
{
GtkWidget* button;
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
GtkAdjustment *adjustment;
#endif
@@ -905,7 +914,7 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
setup_sensitivity(tasklist, builder, "never_group_radio", "auto_group_radio", "always_group_radio", "group-windows" /* key */);
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
tasklist->show_thumbnails_radio = WID("show_thumbnails_radio");
tasklist->hide_thumbnails_radio = WID("hide_thumbnails_radio");
tasklist->thumbnail_size_spin = WID("thumbnail_size_spin");
@@ -916,6 +925,8 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
gtk_adjustment_set_lower (adjustment, 0);
gtk_adjustment_set_upper (adjustment, 999);
gtk_adjustment_set_step_increment (adjustment, 1);
+#else
+ gtk_widget_hide(WID("window_thumbnails"));
#endif
tasklist->minimized_windows_label = WID("minimized_windows_label");
@@ -935,7 +946,7 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist)
g_signal_connect(G_OBJECT(tasklist->auto_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist);
g_signal_connect(G_OBJECT(tasklist->always_group_radio), "toggled", (GCallback) group_windows_toggled, tasklist);
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
/* show thumbnails on hover: */
tasklist_update_thumbnails_radio(tasklist);
g_signal_connect(G_OBJECT(tasklist->show_thumbnails_radio), "toggled", (GCallback) show_thumbnails_toggled, tasklist);
@@ -986,8 +997,10 @@ static void destroy_tasklist(GtkWidget* widget, TasklistData* tasklist)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (tasklist->applet), tasklist);
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
g_signal_handlers_disconnect_by_data (G_OBJECT (tasklist->tasklist), tasklist);
+ g_signal_handlers_disconnect_by_data (tasklist->preview_settings, tasklist);
+ g_object_unref(tasklist->preview_settings);
#endif
g_signal_handlers_disconnect_by_data (tasklist->settings, tasklist);
@@ -997,7 +1010,7 @@ static void destroy_tasklist(GtkWidget* widget, TasklistData* tasklist)
if (tasklist->properties_dialog)
gtk_widget_destroy(tasklist->properties_dialog);
-#if WNCK_CHECK_VERSION (3, 32, 0)
+#ifdef HAVE_WINDOW_PREVIEWS
if (tasklist->preview)
gtk_widget_destroy(tasklist->preview);
#endif
diff --git a/applets/wncklet/window-list.ui b/applets/wncklet/window-list.ui
index 174285a0..85fc5197 100644
--- a/applets/wncklet/window-list.ui
+++ b/applets/wncklet/window-list.ui
@@ -161,7 +161,7 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="vbox15">
+ <object class="GtkBox" id="window_thumbnails">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
diff --git a/configure.ac b/configure.ac
index 14f079bf..399bd21d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ DCONF_REQUIRED=0.13.4
LIBRSVG_REQUIRED=2.36.2
GTK_REQUIRED=3.22.0
LIBWNCK_REQUIRED=3.4.6
+LIBWNCK_PREVIEWS_OPTIONAL=3.32.0
WEATHER_REQUIRED=1.17.0
dnl pkg-config dependency checks
@@ -89,9 +90,16 @@ PKG_CHECK_MODULES(NOTIFICATION_AREA, gtk+-3.0 >= $GTK_REQUIRED mate-desktop-2.0
AC_SUBST(NOTIFICATION_AREA_CFLAGS)
AC_SUBST(NOTIFICATION_AREA_LIBS)
-PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-3.0 >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED)
+# Check if we have a version of libwnck that allows for window previews
+PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-3.0 >= $LIBWNCK_PREVIEWS_OPTIONAL mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED, have_window_previews=yes, [
+ PKG_CHECK_MODULES(WNCKLET, gtk+-3.0 >= $GTK_REQUIRED libwnck-3.0 >= $LIBWNCK_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED, have_window_previews=no)
+])
AC_SUBST(WNCKLET_CFLAGS)
AC_SUBST(WNCKLET_LIBS)
+AM_CONDITIONAL(HAVE_WINDOW_PREVIEWS, [test "x$have_window_previews" = "xyes"])
+if test "x$have_window_previews" = "xyes"; then
+ AC_DEFINE([HAVE_WINDOW_PREVIEWS], 1, [Defined when using a version of libwnck that provides window-list previews])
+fi
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNCS(nl_langinfo)
@@ -319,6 +327,7 @@ applets/notification_area/status-notifier/Makefile
applets/notification_area/system-tray/Makefile
applets/wncklet/Makefile
applets/wncklet/org.mate.panel.applet.window-list.gschema.xml
+applets/wncklet/org.mate.panel.applet.window-list-previews.gschema.xml
applets/wncklet/org.mate.panel.applet.workspace-switcher.gschema.xml
doc/Makefile
doc/reference/Makefile