summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-01-25 21:11:30 +0100
committerJavier <dev.git@javispedro.com>2015-01-25 21:11:30 +0100
commitefad78e4d395a84ac3c8b39b2acb6625e8ff1563 (patch)
tree68a37748168d6bdb308185ec5371425776d1410b
parenta49b49598483e748ad2a15f16c6e882ba2eace23 (diff)
downloadmdock-efad78e4d395a84ac3c8b39b2acb6625e8ff1563.tar.gz
mdock-efad78e4d395a84ac3c8b39b2acb6625e8ff1563.zip
update window name+icon as they change
-rw-r--r--libmdock/mdock-window.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libmdock/mdock-window.c b/libmdock/mdock-window.c
index c53e7ef..b206d7d 100644
--- a/libmdock/mdock-window.c
+++ b/libmdock/mdock-window.c
@@ -56,6 +56,24 @@ static gboolean screenshot_delay_timeout(gpointer user_data)
return G_SOURCE_REMOVE;
}
+static void handle_window_name_changed(MDockWindow *self, WnckWindow *window)
+{
+ gtk_label_set_label(self->priv->title, wnck_window_get_name(self->window));
+ // May be a good time to refresh the screenshot
+ if (wnck_window_is_active(window)) {
+ mdock_window_schedule_screenshot(self);
+ }
+}
+
+static void handle_window_icon_changed(MDockWindow *self, WnckWindow *window)
+{
+ gtk_image_set_from_pixbuf(self->priv->icon,
+ wnck_window_get_icon(self->window));
+ if (wnck_window_is_active(window)) {
+ mdock_window_schedule_screenshot(self);
+ }
+}
+
static gboolean mdock_window_enter_notify(GtkWidget *widget, GdkEventCrossing *event)
{
MDockWindow *self = MDOCK_WINDOW(widget);
@@ -145,6 +163,13 @@ static void mdock_window_constructed(GObject *object)
gtk_table_attach(self->priv->table, GTK_WIDGET(self->priv->img),
0, 3, 1, 2, GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
gtk_widget_show(GTK_WIDGET(self->priv->img));
+
+ g_signal_connect_object(self->window, "name-changed",
+ G_CALLBACK(handle_window_name_changed), self,
+ G_CONNECT_SWAPPED);
+ g_signal_connect_object(self->window, "icon-changed",
+ G_CALLBACK(handle_window_icon_changed), self,
+ G_CONNECT_SWAPPED);
}
static void mdock_window_dispose(GObject *object)