Init signals and events only for iconwin
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 21 Mar 2014 02:51:52 +0000 (22:51 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 21 Mar 2014 02:51:52 +0000 (22:51 -0400)
Previously this was done for both dockwin and iconwin.

src/clock.c
src/clock.h
src/dockapp.c

index 3bd54aa..14a2e21 100644 (file)
@@ -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);
 }
index a0e11b0..7f53c85 100644 (file)
@@ -24,6 +24,6 @@
 #include <gtk/gtk.h>
 
 void
-hvclock_init(GtkWidget *dockwin, GtkWidget *iconwin);
+hvclock_init(GtkWidget *win);
 
 #endif /* CLOCK_H */
index df61e5e..7ce0fff 100644 (file)
@@ -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);