diff options
Diffstat (limited to 'libmdock')
-rw-r--r-- | libmdock/mdock-window.c | 25 |
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) |