Merge lp:~bratsche/indicator-applet/scroll into lp:indicator-applet/0.4

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratsche/indicator-applet/scroll
Merge into: lp:indicator-applet/0.4
Diff against target: 148 lines (+33/-16)
1 file modified
src/applet-main.c (+33/-16)
To merge this branch: bzr merge lp:~bratsche/indicator-applet/scroll
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+21532@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

  review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/applet-main.c'
2--- src/applet-main.c 2010-02-16 22:12:00 +0000
3+++ src/applet-main.c 2010-03-17 06:18:29 +0000
4@@ -7,16 +7,16 @@
5 Authors:
6 Ted Gould <ted@canonical.com>
7
8-This program is free software: you can redistribute it and/or modify it
9-under the terms of the GNU General Public License version 3, as published
10+This program is free software: you can redistribute it and/or modify it
11+under the terms of the GNU General Public License version 3, as published
12 by the Free Software Foundation.
13
14-This program is distributed in the hope that it will be useful, but
15-WITHOUT ANY WARRANTY; without even the implied warranties of
16-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17+This program is distributed in the hope that it will be useful, but
18+WITHOUT ANY WARRANTY; without even the implied warranties of
19+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
20 PURPOSE. See the GNU General Public License for more details.
21
22-You should have received a copy of the GNU General Public License along
23+You should have received a copy of the GNU General Public License along
24 with this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27@@ -171,6 +171,8 @@
28 GtkWidget * menuitem = gtk_menu_item_new();
29 GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
30
31+ g_object_set_data (G_OBJECT (menuitem), "indicator", io);
32+
33 if (entry->image != NULL) {
34 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry->image), FALSE, FALSE, 0);
35 }
36@@ -214,7 +216,7 @@
37 return;
38 }
39
40-static void
41+static void
42 entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data)
43 {
44 g_debug("Signal: Entry Removed");
45@@ -243,7 +245,7 @@
46 }
47
48 /* Gets called when an entry for an object was moved. */
49-static void
50+static void
51 entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry, gint old, gint new, gpointer user_data)
52 {
53 GtkWidget * menu = GTK_WIDGET(user_data);
54@@ -328,6 +330,20 @@
55 }
56
57 static gboolean
58+menubar_scroll (GtkWidget *widget,
59+ GdkEventScroll *event,
60+ gpointer data)
61+{
62+ GtkWidget *menuitem;
63+ GtkWidget *parent;
64+
65+ menuitem = gtk_get_event_widget ((GdkEvent *)event);
66+
67+ IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), "indicator");
68+ g_signal_emit_by_name (io, "scroll", 1, event->direction);
69+}
70+
71+static gboolean
72 menubar_on_expose (GtkWidget * widget,
73 GdkEventExpose *event,
74 GtkWidget * menubar)
75@@ -433,7 +449,7 @@
76
77 log_file = g_io_stream_get_output_stream(G_IO_STREAM(io));
78 }
79-
80+
81 gchar * outputstring = g_strdup_printf("%s\n", message);
82 g_output_stream_write_async(log_file,
83 outputstring, /* data */
84@@ -453,7 +469,7 @@
85 BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb),
86 BONOBO_UI_VERB_END
87 };
88- static const gchar * menu_xml =
89+ static const gchar * menu_xml =
90 "<popup name=\"button3\">"
91 "<menuitem name=\"About Item\" verb=\"IndicatorAppletAbout\" _label=\"" N_("_About") "\" pixtype=\"stock\" pixname=\"gtk-about\"/>"
92 "</popup>";
93@@ -503,7 +519,7 @@
94 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
95 "indicator-applet-complete");
96 #endif
97-
98+
99 /* Init some theme/icon stuff */
100 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
101 INDICATOR_ICONS_DIR);
102@@ -541,6 +557,7 @@
103 GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS);
104 gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
105 g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
106+ g_signal_connect(menubar, "scroll-event", G_CALLBACK (menubar_scroll), NULL);
107 g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar);
108 gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
109
110@@ -580,17 +597,17 @@
111 panel_applet_set_background_widget(applet, menubar);
112 gtk_widget_show(menubar);
113 }
114-
115+
116 /* Background of applet */
117 g_signal_connect(applet, "change-background",
118 G_CALLBACK(cw_panel_background_changed), menubar);
119-
120+
121 gtk_widget_show(GTK_WIDGET(applet));
122
123 return TRUE;
124 }
125
126-static void
127+static void
128 cw_panel_background_changed (PanelApplet *applet,
129 PanelAppletBackgroundType type,
130 GdkColor *colour,
131@@ -608,7 +625,7 @@
132 gtk_widget_modify_style(menubar, rc_style);
133 gtk_rc_style_unref(rc_style);
134
135- switch (type)
136+ switch (type)
137 {
138 case PANEL_NO_BACKGROUND:
139 break;
140@@ -616,7 +633,7 @@
141 gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour);
142 gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour);
143 break;
144-
145+
146 case PANEL_PIXMAP_BACKGROUND:
147 style = gtk_style_copy(GTK_WIDGET (applet)->style);
148 if (style->bg_pixmap[GTK_STATE_NORMAL])

Subscribers

People subscribed via source and target branches

to status/vote changes: