Merge lp:~larsu/indicator-messages/remove-gtk2 into lp:indicator-messages/12.10

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
Approved revision: 272
Merged at revision: 272
Proposed branch: lp:~larsu/indicator-messages/remove-gtk2
Merge into: lp:indicator-messages/12.10
Diff against target: 260 lines (+8/-99)
2 files modified
configure.ac (+8/-30)
src/indicator-messages.c (+0/-69)
To merge this branch: bzr merge lp:~larsu/indicator-messages/remove-gtk2
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+104982@code.launchpad.net

Description of the change

!

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-04-26 19:40:41 +0000
3+++ configure.ac 2012-05-07 21:45:23 +0000
4@@ -38,8 +38,7 @@
5 # Dependencies
6 ###########################
7
8-GTK_REQUIRED_VERSION=2.12
9-GTK3_REQUIRED_VERSION=3.0
10+GTK_REQUIRED_VERSION=3.0
11 GIO_UNIX_REQUIRED_VERSION=2.18
12 PANEL_REQUIRED_VERSION=2.0.0
13 INDICATE_REQUIRED_VERSION=0.6.90
14@@ -47,32 +46,14 @@
15 DBUSMENUGTK_REQUIRED_VERSION=0.5.90
16 GLIB_REQUIRED_VERSION=2.31.20
17
18-AC_ARG_WITH([gtk],
19- [AS_HELP_STRING([--with-gtk],
20- [Which version of gtk to use for the indicator @<:@default=3@:>@])],
21- [],
22- [with_gtk=3])
23+PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK_REQUIRED_VERSION
24+ gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
25+ indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
26+ indicate-0.7 >= $INDICATE_REQUIRED_VERSION
27+ dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
28+ glib-2.0 >= $GLIB_REQUIRED_VERSION
29+ gmodule-2.0 >= $GLIB_REQUIRED_VERSION)
30
31-AS_IF([test "x$with_gtk" = x3],
32- [PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
33- gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
34- indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
35- indicate-0.7 >= $INDICATE_REQUIRED_VERSION
36- dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
37- glib-2.0 >= $GLIB_REQUIRED_VERSION
38- gmodule-2.0 >= $GLIB_REQUIRED_VERSION)
39- ],
40- [test "x$with_gtk" = x2],
41- [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
42- gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
43- indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
44- indicate-0.7 >= $INDICATE_REQUIRED_VERSION
45- dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
46- glib-2.0 >= $GLIB_REQUIRED_VERSION
47- gmodule-2.0 >= $GLIB_REQUIRED_VERSION)
48- ],
49- [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])]
50-)
51 AC_SUBST(APPLET_CFLAGS)
52 AC_SUBST(APPLET_LIBS)
53
54@@ -144,9 +125,6 @@
55 if test "x$with_localinstall" = "xyes"; then
56 INDICATORDIR="${libdir}/indicators/2/"
57 INDICATORICONSDIR="${datadir}/libindicate/icons/"
58-elif test "x$with_gtk" = x2; then
59- INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4`
60- INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4`
61 else
62 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4`
63 INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3-0.4`
64
65=== modified file 'src/indicator-messages.c'
66--- src/indicator-messages.c 2012-03-16 23:14:37 +0000
67+++ src/indicator-messages.c 2012-05-07 21:45:23 +0000
68@@ -410,16 +410,9 @@
69 }
70
71 /* Draws a triangle on the left, using fg[STATE_TYPE] color. */
72-#if GTK_CHECK_VERSION(3, 0, 0)
73 static gboolean
74 application_triangle_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
75 {
76-#else
77-static gboolean
78-application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
79-{
80- cairo_t *cr;
81-#endif
82 GtkAllocation allocation;
83 GtkStyle *style;
84 int x, y, arrow_width, arrow_height;
85@@ -438,20 +431,10 @@
86 arrow_width = 5; /* the pixel-based reference triangle is 5x9 */
87 arrow_height = 9;
88 gtk_widget_get_allocation (widget, &allocation);
89-#if GTK_CHECK_VERSION(3, 0, 0)
90 x = 0;
91 y = allocation.height/2.0 - (double)arrow_height/2.0;
92-#else
93- x = allocation.x;
94- y = allocation.y + allocation.height/2.0 - (double)arrow_height/2.0;
95-#endif
96
97-#if GTK_CHECK_VERSION(3, 0, 0)
98 cairo_save (cr);
99-#else
100- /* initialize cairo drawing area */
101- cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget));
102-#endif
103
104 /* set line width */
105 cairo_set_line_width (cr, 1.0);
106@@ -466,12 +449,7 @@
107 style->fg[gtk_widget_get_state(widget)].blue/65535.0);
108 cairo_fill (cr);
109
110-#if GTK_CHECK_VERSION(3, 0, 0)
111 cairo_restore (cr);
112-#else
113- /* remember to destroy cairo context to avoid leaks */
114- cairo_destroy (cr);
115-#endif
116
117 return FALSE;
118 }
119@@ -479,16 +457,12 @@
120 static gint
121 gtk_widget_get_font_size (GtkWidget *widget)
122 {
123-#if GTK_CHECK_VERSION(3, 0, 0)
124 const PangoFontDescription *font;
125
126 font = gtk_style_context_get_font (gtk_widget_get_style_context (widget),
127 gtk_widget_get_state_flags (widget));
128
129 return pango_font_description_get_size (font) / PANGO_SCALE;
130-#else
131- return 12;
132-#endif
133 }
134
135 /* Custom function to draw rounded rectangle with max radius */
136@@ -506,16 +480,9 @@
137 }
138
139 /* Draws a rounded rectangle with text inside. */
140-#if GTK_CHECK_VERSION(3, 0, 0)
141 static gboolean
142 numbers_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
143 {
144-#else
145-static gboolean
146-numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
147-{
148- cairo_t *cr;
149-#endif
150 GtkAllocation allocation;
151 GtkStyle *style;
152 double x, y, w, h;
153@@ -535,13 +502,8 @@
154
155 /* set arrow position / dimensions */
156 gtk_widget_get_allocation (widget, &allocation);
157-#if GTK_CHECK_VERSION(3, 0, 0)
158 x = 0;
159 y = 0;
160-#else
161- x = allocation.x;
162- y = allocation.y;
163-#endif
164 w = allocation.width;
165 h = allocation.height;
166
167@@ -552,12 +514,7 @@
168 if (layout_extents.width == 0)
169 return TRUE;
170
171-#if GTK_CHECK_VERSION(3, 0, 0)
172 cairo_save (cr);
173-#else
174- /* initialize cairo drawing area */
175- cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget));
176-#endif
177
178 /* set line width */
179 cairo_set_line_width (cr, 1.0);
180@@ -577,12 +534,7 @@
181 pango_cairo_layout_path (cr, layout);
182 cairo_fill (cr);
183
184-#if GTK_CHECK_VERSION(3, 0, 0)
185 cairo_restore (cr);
186-#else
187- /* remember to destroy cairo context to avoid leaks */
188- cairo_destroy (cr);
189-#endif
190
191 return TRUE;
192 }
193@@ -599,11 +551,7 @@
194 gint padding = 4;
195 gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL);
196
197-#if GTK_CHECK_VERSION(3, 0, 0)
198 GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding);
199-#else
200- GtkWidget * hbox = gtk_hbox_new(FALSE, padding);
201-#endif
202
203 GtkWidget * icon = gtk_image_new_from_icon_name(dbusmenu_menuitem_property_get(newitem, APPLICATION_MENUITEM_PROP_ICON), GTK_ICON_SIZE_MENU);
204 gtk_misc_set_alignment(GTK_MISC(icon), 1.0 /* right aligned */, 0.5);
205@@ -623,11 +571,7 @@
206 /* Make sure we can handle the label changing */
207 g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_prop_change_cb), label);
208 g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_icon_change_cb), icon);
209-#if GTK_CHECK_VERSION(3, 0, 0)
210 g_signal_connect_after(G_OBJECT (gmi), "draw", G_CALLBACK (application_triangle_draw_cb), newitem);
211-#else
212- g_signal_connect_after(G_OBJECT (gmi), "expose_event", G_CALLBACK (application_triangle_draw_cb), newitem);
213-#endif
214
215 return TRUE;
216 }
217@@ -709,11 +653,7 @@
218 gint font_size = gtk_widget_get_font_size (GTK_WIDGET (gmi));
219 gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL);
220
221-#if GTK_CHECK_VERSION(3, 0, 0)
222 GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding);
223-#else
224- GtkWidget * hbox = gtk_hbox_new(FALSE, padding);
225-#endif
226
227 /* Icon, probably someone's face or avatar on an IM */
228 mi_data->icon = gtk_image_new();
229@@ -723,9 +663,7 @@
230 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
231 gtk_widget_set_size_request(GTK_WIDGET (gmi), -1, height + 4);
232
233-#if GTK_CHECK_VERSION(3, 0, 0)
234 gtk_widget_set_margin_left (hbox, width + padding);
235-#endif
236
237 GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON);
238 if (pixbuf != NULL) {
239@@ -769,21 +707,14 @@
240 "is-lozenge",
241 GINT_TO_POINTER (dbusmenu_menuitem_property_get_bool (newitem, INDICATOR_MENUITEM_PROP_RIGHT_IS_LOZENGE)));
242 /* install extra decoration overlay */
243-#if GTK_CHECK_VERSION(3, 0, 0)
244 g_signal_connect (G_OBJECT (mi_data->right), "draw",
245 G_CALLBACK (numbers_draw_cb), NULL);
246-#else
247- g_signal_connect (G_OBJECT (mi_data->right), "expose_event",
248- G_CALLBACK (numbers_draw_cb), NULL);
249-#endif
250
251 gtk_misc_set_alignment(GTK_MISC(mi_data->right), 1.0, 0.5);
252 gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, padding + font_size/2.0);
253 gtk_label_set_width_chars (GTK_LABEL (mi_data->right), 2);
254-#if GTK_CHECK_VERSION(3, 0, 0)
255 gtk_style_context_add_class (gtk_widget_get_style_context (mi_data->right),
256 "accelerator");
257-#endif
258 gtk_widget_show(mi_data->right);
259
260 gtk_container_add(GTK_CONTAINER(gmi), hbox);

Subscribers

People subscribed via source and target branches