From: Hugo Villeneuve Date: Fri, 21 Mar 2014 02:51:52 +0000 (-0400) Subject: Init signals and events only for iconwin X-Git-Tag: v1.1.0~4 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=b34cd70e02be47cd9be2b703266b40cd7cbcd631;p=dockapps%2Fhvclock.git Init signals and events only for iconwin Previously this was done for both dockwin and iconwin. --- diff --git a/src/clock.c b/src/clock.c index 3bd54aa..14a2e21 100644 --- a/src/clock.c +++ b/src/clock.c @@ -450,31 +450,22 @@ hvclock_update(gpointer data) } void -hvclock_init(GtkWidget *dockwin, GtkWidget *iconwin) +hvclock_init(GtkWidget *win) { - gtk_widget_add_events(dockwin, GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK); - gtk_widget_add_events(iconwin, GDK_BUTTON_PRESS_MASK | + gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); - g_signal_connect(G_OBJECT(dockwin), "expose-event", - G_CALLBACK(hvclock_expose), NULL); - g_signal_connect(G_OBJECT(iconwin), "expose-event", + g_signal_connect(G_OBJECT(win), "expose-event", G_CALLBACK(hvclock_expose), NULL); - g_signal_connect(G_OBJECT(dockwin), "button-press-event", - G_CALLBACK(hvclock_button_release), NULL); - g_signal_connect(G_OBJECT(iconwin), "button-press-event", - G_CALLBACK(hvclock_button_release), NULL); - g_signal_connect(G_OBJECT(dockwin), "button-release-event", + g_signal_connect(G_OBJECT(win), "button-press-event", G_CALLBACK(hvclock_button_release), NULL); - g_signal_connect(G_OBJECT(iconwin), "button-release-event", + g_signal_connect(G_OBJECT(win), "button-release-event", G_CALLBACK(hvclock_button_release), NULL); /* update the clock once a second */ - g_timeout_add(1000, hvclock_update, iconwin); + g_timeout_add(1000, hvclock_update, win); - hvclock_redraw_canvas(iconwin); + hvclock_redraw_canvas(win); } diff --git a/src/clock.h b/src/clock.h index a0e11b0..7f53c85 100644 --- a/src/clock.h +++ b/src/clock.h @@ -24,6 +24,6 @@ #include void -hvclock_init(GtkWidget *dockwin, GtkWidget *iconwin); +hvclock_init(GtkWidget *win); #endif /* CLOCK_H */ diff --git a/src/dockapp.c b/src/dockapp.c index df61e5e..7ce0fff 100644 --- a/src/dockapp.c +++ b/src/dockapp.c @@ -146,9 +146,11 @@ dockapp_init(int argc, char *argv[]) gtk_widget_realize(dockwin); gtk_widget_realize(iconwin); + + /* Sets the icon of dockwin as iconwin. */ gdk_window_set_icon(dockwin->window, iconwin->window, NULL, NULL); - hvclock_init(dockwin, iconwin); + hvclock_init(iconwin); gtk_widget_show(iconwin);