From c144388a3c09049d97d39e14a3812557f385da54 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Mon, 7 May 2012 14:41:28 -0700 Subject: Remove gtk2 support --- configure.ac | 40 +++++++--------------------- src/indicator-messages.c | 69 ------------------------------------------------ 2 files changed, 9 insertions(+), 100 deletions(-) diff --git a/configure.ac b/configure.ac index 77ad41b..ca879a1 100644 --- a/configure.ac +++ b/configure.ac @@ -38,8 +38,7 @@ AC_PROG_CXX # Dependencies ########################### -GTK_REQUIRED_VERSION=2.12 -GTK3_REQUIRED_VERSION=3.0 +GTK_REQUIRED_VERSION=3.0 GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.6.90 @@ -47,32 +46,14 @@ INDICATOR_REQUIRED_VERSION=0.3.19 DBUSMENUGTK_REQUIRED_VERSION=0.5.90 GLIB_REQUIRED_VERSION=2.31.20 -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk], - [Which version of gtk to use for the indicator @<:@default=3@:>@])], - [], - [with_gtk=3]) - -AS_IF([test "x$with_gtk" = x3], - [PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK3_REQUIRED_VERSION - gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION - indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION - indicate-0.7 >= $INDICATE_REQUIRED_VERSION - dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - gmodule-2.0 >= $GLIB_REQUIRED_VERSION) - ], - [test "x$with_gtk" = x2], - [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION - gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION - indicator-0.4 >= $INDICATOR_REQUIRED_VERSION - indicate-0.7 >= $INDICATE_REQUIRED_VERSION - dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - gmodule-2.0 >= $GLIB_REQUIRED_VERSION) - ], - [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])] -) +PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION + indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION + indicate-0.7 >= $INDICATE_REQUIRED_VERSION + dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION + glib-2.0 >= $GLIB_REQUIRED_VERSION + gmodule-2.0 >= $GLIB_REQUIRED_VERSION) + AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) @@ -144,9 +125,6 @@ AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install all if test "x$with_localinstall" = "xyes"; then INDICATORDIR="${libdir}/indicators/2/" INDICATORICONSDIR="${datadir}/libindicate/icons/" -elif test "x$with_gtk" = x2; then - INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4` - INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4` else INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4` INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3-0.4` diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 748b73b..32f97f7 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -410,16 +410,9 @@ application_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * valu } /* Draws a triangle on the left, using fg[STATE_TYPE] color. */ -#if GTK_CHECK_VERSION(3, 0, 0) static gboolean application_triangle_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data) { -#else -static gboolean -application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) -{ - cairo_t *cr; -#endif GtkAllocation allocation; GtkStyle *style; int x, y, arrow_width, arrow_height; @@ -438,20 +431,10 @@ application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer arrow_width = 5; /* the pixel-based reference triangle is 5x9 */ arrow_height = 9; gtk_widget_get_allocation (widget, &allocation); -#if GTK_CHECK_VERSION(3, 0, 0) x = 0; y = allocation.height/2.0 - (double)arrow_height/2.0; -#else - x = allocation.x; - y = allocation.y + allocation.height/2.0 - (double)arrow_height/2.0; -#endif -#if GTK_CHECK_VERSION(3, 0, 0) cairo_save (cr); -#else - /* initialize cairo drawing area */ - cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget)); -#endif /* set line width */ cairo_set_line_width (cr, 1.0); @@ -466,12 +449,7 @@ application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer style->fg[gtk_widget_get_state(widget)].blue/65535.0); cairo_fill (cr); -#if GTK_CHECK_VERSION(3, 0, 0) cairo_restore (cr); -#else - /* remember to destroy cairo context to avoid leaks */ - cairo_destroy (cr); -#endif return FALSE; } @@ -479,16 +457,12 @@ application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer static gint gtk_widget_get_font_size (GtkWidget *widget) { -#if GTK_CHECK_VERSION(3, 0, 0) const PangoFontDescription *font; font = gtk_style_context_get_font (gtk_widget_get_style_context (widget), gtk_widget_get_state_flags (widget)); return pango_font_description_get_size (font) / PANGO_SCALE; -#else - return 12; -#endif } /* Custom function to draw rounded rectangle with max radius */ @@ -506,16 +480,9 @@ custom_cairo_rounded_rectangle (cairo_t *cr, } /* Draws a rounded rectangle with text inside. */ -#if GTK_CHECK_VERSION(3, 0, 0) static gboolean numbers_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data) { -#else -static gboolean -numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) -{ - cairo_t *cr; -#endif GtkAllocation allocation; GtkStyle *style; double x, y, w, h; @@ -535,13 +502,8 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) /* set arrow position / dimensions */ gtk_widget_get_allocation (widget, &allocation); -#if GTK_CHECK_VERSION(3, 0, 0) x = 0; y = 0; -#else - x = allocation.x; - y = allocation.y; -#endif w = allocation.width; h = allocation.height; @@ -552,12 +514,7 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) if (layout_extents.width == 0) return TRUE; -#if GTK_CHECK_VERSION(3, 0, 0) cairo_save (cr); -#else - /* initialize cairo drawing area */ - cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget)); -#endif /* set line width */ cairo_set_line_width (cr, 1.0); @@ -577,12 +534,7 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) pango_cairo_layout_path (cr, layout); cairo_fill (cr); -#if GTK_CHECK_VERSION(3, 0, 0) cairo_restore (cr); -#else - /* remember to destroy cairo context to avoid leaks */ - cairo_destroy (cr); -#endif return TRUE; } @@ -599,11 +551,7 @@ new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu gint padding = 4; gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL); -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding); -#else - GtkWidget * hbox = gtk_hbox_new(FALSE, padding); -#endif GtkWidget * icon = gtk_image_new_from_icon_name(dbusmenu_menuitem_property_get(newitem, APPLICATION_MENUITEM_PROP_ICON), GTK_ICON_SIZE_MENU); gtk_misc_set_alignment(GTK_MISC(icon), 1.0 /* right aligned */, 0.5); @@ -623,11 +571,7 @@ new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu /* Make sure we can handle the label changing */ g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_prop_change_cb), label); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_icon_change_cb), icon); -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect_after(G_OBJECT (gmi), "draw", G_CALLBACK (application_triangle_draw_cb), newitem); -#else - g_signal_connect_after(G_OBJECT (gmi), "expose_event", G_CALLBACK (application_triangle_draw_cb), newitem); -#endif return TRUE; } @@ -709,11 +653,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gint font_size = gtk_widget_get_font_size (GTK_WIDGET (gmi)); gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL); -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding); -#else - GtkWidget * hbox = gtk_hbox_new(FALSE, padding); -#endif /* Icon, probably someone's face or avatar on an IM */ mi_data->icon = gtk_image_new(); @@ -723,9 +663,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); gtk_widget_set_size_request(GTK_WIDGET (gmi), -1, height + 4); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_margin_left (hbox, width + padding); -#endif GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON); if (pixbuf != NULL) { @@ -769,21 +707,14 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm "is-lozenge", GINT_TO_POINTER (dbusmenu_menuitem_property_get_bool (newitem, INDICATOR_MENUITEM_PROP_RIGHT_IS_LOZENGE))); /* install extra decoration overlay */ -#if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect (G_OBJECT (mi_data->right), "draw", G_CALLBACK (numbers_draw_cb), NULL); -#else - g_signal_connect (G_OBJECT (mi_data->right), "expose_event", - G_CALLBACK (numbers_draw_cb), NULL); -#endif gtk_misc_set_alignment(GTK_MISC(mi_data->right), 1.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, padding + font_size/2.0); gtk_label_set_width_chars (GTK_LABEL (mi_data->right), 2); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_style_context_add_class (gtk_widget_get_style_context (mi_data->right), "accelerator"); -#endif gtk_widget_show(mi_data->right); gtk_container_add(GTK_CONTAINER(gmi), hbox); -- cgit v1.2.3