diff options
46 files changed, 134 insertions, 1489 deletions
diff --git a/Makefile.am b/Makefile.am index ab9fc973..f43a44ab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -80,9 +80,6 @@ EXTRA_DIST = \ omf.make \ autogen.sh -DISTCHECK_CONFIGURE_FLAGS = \ - --with-gtk=$(GTK_API_VERSION) - # Build ChangeLog from GIT history ChangeLog: $(AM_V_GEN) if test -d $(top_srcdir)/.git; then \ @@ -1,3 +1,6 @@ +Changes in MATE-Applets 1.17.0 +============================== + Changes in MATE-Applets 1.16.0 ============================== @@ -18,7 +18,7 @@ Requirements You need at least: mate-panel - gtk+-2.24.0 + gtk+-3.14.0 glib-2.36.0 libgtop-2.12.0 libwnck diff --git a/accessx-status/applet.c b/accessx-status/applet.c index 053e1e0c..366dfcfc 100644 --- a/accessx-status/applet.c +++ b/accessx-status/applet.c @@ -38,11 +38,6 @@ #include <X11/keysymdef.h> #include "applet.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static int xkb_base_event_type = 0; static GtkIconSize icon_size_spec; @@ -197,12 +192,8 @@ static void dialog_cb(GtkAction* action, AccessxStatusApplet* sapplet) &error); if (!error) { -#if GTK_CHECK_VERSION (3, 0, 0) launch_context = gdk_display_get_app_launch_context ( gtk_widget_get_display (GTK_WIDGET (screen))); -#else - launch_context = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (launch_context, screen); g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error); @@ -404,12 +395,7 @@ static gboolean timer_reset_bouncekeys_image(gpointer user_data) static GdkPixbuf* accessx_status_applet_get_glyph_pixbuf(AccessxStatusApplet* sapplet, GtkWidget* widget, GdkPixbuf* base, GdkColor* fg, GdkColor* bg, gchar* glyphstring) { GdkPixbuf* glyph_pixbuf; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; -#else - GdkPixbuf *alpha_pixbuf; - GdkPixmap* pixmap; -#endif PangoLayout* layout; PangoRectangle ink, logic; PangoContext* pango_context; @@ -417,21 +403,13 @@ static GdkPixbuf* accessx_status_applet_get_glyph_pixbuf(AccessxStatusApplet* sa gint h = gdk_pixbuf_get_height(base); cairo_t *cr; -#if GTK_CHECK_VERSION (3, 0, 0) surface = gdk_window_create_similar_surface (gdk_get_default_root_window (), CAIRO_CONTENT_COLOR_ALPHA, w, h); -#else - pixmap = gdk_pixmap_new(gdk_get_default_root_window (),w, h, -1); -#endif pango_context = gtk_widget_get_pango_context(widget); layout = pango_layout_new(pango_context); pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); pango_layout_set_text(layout, glyphstring, -1); -#if GTK_CHECK_VERSION (3, 0, 0) cr = cairo_create (surface); -#else - cr = gdk_cairo_create (pixmap); -#endif gdk_cairo_set_source_color (cr, bg); cairo_paint (cr); gdk_cairo_set_source_color (cr, fg); @@ -443,19 +421,10 @@ static GdkPixbuf* accessx_status_applet_get_glyph_pixbuf(AccessxStatusApplet* sa cairo_destroy (cr); g_object_unref(layout); -#if GTK_CHECK_VERSION (3, 0, 0) glyph_pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, w, h); cairo_surface_destroy (surface); return glyph_pixbuf; -#else - glyph_pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, 0, 0, 0, 0, w, h); - g_object_unref(pixmap); - alpha_pixbuf = gdk_pixbuf_add_alpha(glyph_pixbuf, TRUE, bg->red >> 8, bg->green >> 8, bg->blue >> 8); - g_object_unref(G_OBJECT(glyph_pixbuf)); - - return alpha_pixbuf; -#endif } static GdkPixbuf* accessx_status_applet_slowkeys_image(AccessxStatusApplet* sapplet, XkbAccessXNotifyEvent* event) @@ -523,11 +492,7 @@ static GdkPixbuf* accessx_status_applet_slowkeys_image(AccessxStatusApplet* sapp } } -#if GTK_CHECK_VERSION (3, 0, 0) fg = style->fg[gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet))]; -#else - fg = style->fg[gtk_widget_get_state(GTK_WIDGET(sapplet->applet))]; -#endif glyph_pixbuf = accessx_status_applet_get_glyph_pixbuf(sapplet, GTK_WIDGET(sapplet->applet), ret_pixbuf, &fg, &bg, glyphstring); gdk_pixbuf_composite(glyph_pixbuf, ret_pixbuf, 0, 0, gdk_pixbuf_get_width(glyph_pixbuf), gdk_pixbuf_get_height(glyph_pixbuf), 0., 0., 1.0, 1.0, GDK_INTERP_NEAREST, 255); g_object_unref(glyph_pixbuf); @@ -548,11 +513,7 @@ static GdkPixbuf* accessx_status_applet_bouncekeys_image(AccessxStatusApplet* sa g_assert(sapplet->applet); style = gtk_widget_get_style(GTK_WIDGET(sapplet->applet)); -#if GTK_CHECK_VERSION (3, 0, 0) fg = style->text[gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet))]; -#else - fg = style->text[gtk_widget_get_state(GTK_WIDGET(sapplet->applet))]; -#endif bg = style->base[GTK_STATE_NORMAL]; if (event != NULL) @@ -661,20 +622,12 @@ static void accessx_status_applet_update(AccessxStatusApplet* sapplet, AccessxSt if (locked_mods & modifiers[i].mask) { gtk_widget_set_sensitive(modifiers[i].indicator, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (modifiers[i].indicator, GTK_STATE_FLAG_SELECTED, TRUE); -#else - gtk_widget_set_state(modifiers[i].indicator, GTK_STATE_SELECTED); -#endif } else if (latched_mods & modifiers[i].mask) { gtk_widget_set_sensitive(modifiers[i].indicator, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (modifiers[i].indicator, GTK_STATE_FLAG_NORMAL, TRUE); -#else - gtk_widget_set_state(modifiers[i].indicator, GTK_STATE_NORMAL); -#endif } else { @@ -809,11 +762,7 @@ static void accessx_status_applet_notify_xkb_device(AccessxStatusApplet* sapplet if (event->led_state &= ALT_GRAPH_LED_MASK) { gtk_widget_set_sensitive(sapplet->alt_graph_indicator, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (sapplet->alt_graph_indicator, GTK_STATE_FLAG_NORMAL, TRUE); -#else - gtk_widget_set_state(sapplet->alt_graph_indicator, GTK_STATE_NORMAL); -#endif } else { @@ -906,11 +855,7 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet* case GTK_STATE_NORMAL: alpha = 255; gtk_widget_set_sensitive(widget, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_NORMAL, TRUE); -#else - gtk_widget_set_state(widget, GTK_STATE_NORMAL); -#endif break; case GTK_STATE_SELECTED: /* FIXME: should use text/base here, for selected ? */ @@ -918,11 +863,7 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet* bg = &style->black; alpha = 255; gtk_widget_set_sensitive(widget, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, TRUE); -#else - gtk_widget_set_state(widget, GTK_STATE_SELECTED); -#endif break; case GTK_STATE_INSENSITIVE: default: @@ -954,11 +895,7 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet* gtk_icon_source_free(source); } /* we mucked about with the box's state to create the icons; restore it to normal */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_NORMAL, TRUE); -#else - gtk_widget_set_state(widget, GTK_STATE_NORMAL); -#endif gtk_widget_set_sensitive(widget, TRUE); return icon_set; @@ -1133,18 +1070,16 @@ static AccessxStatusApplet* create_applet(MatePanelApplet* applet) if (sapplet->orient == MATE_PANEL_APPLET_ORIENT_LEFT || sapplet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT) { - box = gtk_vbox_new(FALSE, 0); - stickyfoo = gtk_vbox_new(TRUE, 0); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + stickyfoo = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); } else { - box = gtk_hbox_new(FALSE, 0); - stickyfoo = gtk_hbox_new(TRUE, 0); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + stickyfoo = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE); -#endif large_toolbar_pixels = 24; /* FIXME */ if (mate_panel_applet_get_size(sapplet->applet) >= large_toolbar_pixels) @@ -1225,17 +1160,15 @@ static void accessx_status_applet_reorient(GtkWidget* widget, MatePanelAppletOri if (o == MATE_PANEL_APPLET_ORIENT_LEFT || o == MATE_PANEL_APPLET_ORIENT_RIGHT) { - box = gtk_vbox_new(FALSE, 0); - stickyfoo = gtk_vbox_new(TRUE, 0); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + stickyfoo = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); } else { - box = gtk_hbox_new(FALSE, 0); - stickyfoo = gtk_hbox_new(TRUE, 0); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + stickyfoo = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE); -#endif accessx_status_applet_layout_box(sapplet, box, stickyfoo); } diff --git a/battstat/battstat.h b/battstat/battstat.h index 1f4e800f..b0b59808 100644 --- a/battstat/battstat.h +++ b/battstat/battstat.h @@ -114,13 +114,8 @@ typedef struct _ProgressData { /* label changed type (% <-> h:mm) and must be refreshed */ gboolean refresh_label; -#if GTK_CHECK_VERSION (3, 0, 0) /* the main grid that contains the visual elements */ GtkWidget *grid; -#else - /* the main table that contains the visual elements */ - GtkWidget *table; -#endif /* the visual elements */ GtkWidget *battery; @@ -143,11 +138,7 @@ typedef struct _ProgressData { /* on a vertical or horizontal panel? (up/down/left/right) */ MatePanelAppletOrient orienttype; -#if GTK_CHECK_VERSION (3, 0, 0) /* the current layout of the visual elements inside the grid */ -#else - /* the current layout of the visual elements inside the table */ -#endif LayoutConfiguration layout; /* g_timeout source identifier */ diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c index 31e64b86..f724b697 100644 --- a/battstat/battstat_applet.c +++ b/battstat/battstat_applet.c @@ -51,11 +51,6 @@ #define gettext_noop(String) (String) #endif -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - #define BATTSTAT_SCHEMA "org.mate.panel.applet.battstat" static gboolean check_for_updates (gpointer data); @@ -451,7 +446,7 @@ battery_full_dialog (GtkWidget *applet) G_OBJECT (dialog)); gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); pixbuf = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default (), "battery", @@ -526,11 +521,7 @@ battery_low_update_text( ProgressData *battstat, BatteryStatus *info ) battstat->battery_low_dialog == NULL ) return; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (battstat->battery_low_label), NULL, &size); -#else - gtk_widget_size_request( GTK_WIDGET( battstat->battery_low_label ), &size ); -#endif /* If the label has never been set before, the width will be 0. If it has been set before (width > 0) then we want to keep the size of @@ -615,7 +606,7 @@ battery_low_dialog( ProgressData *battery, BatteryStatus *info ) gtk_container_set_border_width (GTK_CONTAINER (battery->battery_low_dialog), 6); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "battery", @@ -624,7 +615,7 @@ battery_low_dialog( ProgressData *battery, BatteryStatus *info ) NULL); image = gtk_image_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0); label = gtk_label_new (""); @@ -1317,7 +1308,6 @@ load_preferences(ProgressData *battstat) battstat->showtext = g_settings_get_int (settings, "show-text"); } -#if GTK_CHECK_VERSION (3, 0, 0) /* Convenience function to attach a child widget to a GtkGrid in the position indicated by 'loc'. This is very special-purpose for 3x3 gridss and only supports positions that are used in this applet. @@ -1359,53 +1349,6 @@ grid_layout_attach (GtkGrid *grid, LayoutLocation loc, GtkWidget *child) break; } } -#else -/* Convenience function to attach a child widget to a GtkTable in the - position indicated by 'loc'. This is very special-purpose for 3x3 - tables and only supports positions that are used in this applet. - */ -static void -table_layout_attach( GtkTable *table, LayoutLocation loc, GtkWidget *child ) -{ - GtkAttachOptions flags; - - flags = GTK_FILL | GTK_EXPAND; - - switch( loc ) - { - case LAYOUT_LONG: - gtk_table_attach( table, child, 1, 2, 0, 2, flags, flags, 2, 2 ); - break; - - case LAYOUT_TOPLEFT: - gtk_table_attach( table, child, 0, 1, 0, 1, flags, flags, 2, 2 ); - break; - - case LAYOUT_TOP: - gtk_table_attach( table, child, 1, 2, 0, 1, flags, flags, 2, 2 ); - break; - - case LAYOUT_LEFT: - gtk_table_attach( table, child, 0, 1, 1, 2, flags, flags, 2, 2 ); - break; - - case LAYOUT_CENTRE: - gtk_table_attach( table, child, 1, 2, 1, 2, flags, flags, 2, 2 ); - break; - - case LAYOUT_RIGHT: - gtk_table_attach( table, child, 2, 3, 1, 2, flags, flags, 2, 2 ); - break; - - case LAYOUT_BOTTOM: - gtk_table_attach( table, child, 1, 2, 2, 3, flags, flags, 2, 2 ); - break; - - default: - break; - } -} -#endif /* The layout has (maybe) changed. Calculate what layout we ought to be using and update some things if anything has changed. This is called @@ -1505,7 +1448,6 @@ reconfigure_layout( ProgressData *battstat ) { /* Something in the layout has changed. Rebuild. */ -#if GTK_CHECK_VERSION (3, 0, 0) /* Start by removing any elements in the grid from the grid. */ if( battstat->layout.text ) gtk_container_remove( GTK_CONTAINER( battstat->grid ), @@ -1524,26 +1466,6 @@ reconfigure_layout( ProgressData *battstat ) c.status, battstat->status ); grid_layout_attach( GTK_GRID(battstat->grid), c.text, battstat->percent ); -#else - /* Start by removing any elements in the table from the table. */ - if( battstat->layout.text ) - gtk_container_remove( GTK_CONTAINER( battstat->table ), - battstat->percent ); - if( battstat->layout.status ) - gtk_container_remove( GTK_CONTAINER( battstat->table ), - battstat->status ); - if( battstat->layout.battery ) - gtk_container_remove( GTK_CONTAINER( battstat->table ), - battstat->battery ); - - /* Attach the elements to their new locations. */ - table_layout_attach( GTK_TABLE(battstat->table), - c.battery, battstat->battery ); - table_layout_attach( GTK_TABLE(battstat->table), - c.status, battstat->status ); - table_layout_attach( GTK_TABLE(battstat->table), - c.text, battstat->percent ); -#endif gtk_widget_show_all( battstat->applet ); } @@ -1580,11 +1502,7 @@ create_layout(ProgressData *battstat) GTK_WIDGET( battstat->applet ) ); /* Allocate the four widgets that we need. */ -#if GTK_CHECK_VERSION (3, 0, 0) battstat->grid = gtk_grid_new (); -#else - battstat->table = gtk_table_new( 3, 3, FALSE ); -#endif battstat->percent = gtk_label_new( "" ); battstat->status = gtk_image_new(); battstat->battery = gtk_image_new(); @@ -1604,24 +1522,15 @@ create_layout(ProgressData *battstat) g_object_ref_sink( G_OBJECT( battstat->percent ) ); g_object_ref_sink( G_OBJECT( battstat->battery ) ); -#if GTK_CHECK_VERSION (3, 0, 0) /* Let reconfigure_layout know that the grid is currently empty. */ -#else - /* Let reconfigure_layout know that the table is currently empty. */ -#endif battstat->layout.status = LAYOUT_NONE; battstat->layout.text = LAYOUT_NONE; battstat->layout.battery = LAYOUT_NONE; -#if GTK_CHECK_VERSION (3, 0, 0) /* Put the grid directly inside the applet and show everything. */ gtk_widget_set_halign (battstat->grid, GTK_ALIGN_CENTER); gtk_widget_set_valign (battstat->grid, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (battstat->applet), battstat->grid); -#else - /* Put the table directly inside the applet and show everything. */ - gtk_container_add (GTK_CONTAINER (battstat->applet), battstat->table); -#endif gtk_widget_show_all (battstat->applet); /* Attach all sorts of signals to the applet. */ diff --git a/battstat/power-management.c b/battstat/power-management.c index 8c2eb7b2..9f4113f0 100644 --- a/battstat/power-management.c +++ b/battstat/power-management.c @@ -61,10 +61,6 @@ "the ACPI subsystem. Check to make sure the " \ "ACPI subsystem is properly loaded.") -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static const char *apm_readinfo (BatteryStatus *status); static int pm_initialised; #ifdef HAVE_UPOWER @@ -121,7 +117,7 @@ initialise_test( void ) test_status.on_ac_power = FALSE; test_status.charging = FALSE; - box = GTK_BOX( gtk_vbox_new( 5, FALSE ) ); + box = GTK_BOX( gtk_box_new (GTK_ORIENTATION_VERTICAL, 5 ) ); gtk_box_pack_start( box, gtk_label_new( "percent" ), TRUE, TRUE, 0); w = gtk_spin_button_new_with_range( -1.0, 100.0, 1 ); diff --git a/charpick/charpick.c b/charpick/charpick.c index d06b98e3..97d07a06 100644 --- a/charpick/charpick.c +++ b/charpick/charpick.c @@ -11,11 +11,6 @@ #endif #include "charpick.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - /* The comment for each char list has the html entity names of the chars */ /* All gunicar codes should end in 0 */ @@ -319,7 +314,6 @@ populate_menu (charpick_data *curr_data) } build_table(curr_data); -#if GTK_CHECK_VERSION (3, 0, 0) /*Set up custom theme and transparency support*/ GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu)); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ @@ -331,7 +325,6 @@ populate_menu (charpick_data *curr_data) context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif } static void @@ -342,17 +335,10 @@ get_menu_pos (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) gint tempx, tempy, width, height; gint screen_width, screen_height; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &reqmenu); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &reqmenu); -#endif gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), &tempx, &tempy); gdk_window_get_geometry (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), NULL, NULL, &width, &height -#if !GTK_CHECK_VERSION (3, 0, 0) - , NULL -#endif ); switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (curr_data->applet))) { @@ -395,7 +381,6 @@ chooser_button_clicked (GtkButton *button, charpick_data *curr_data) static inline void force_no_focus_padding (GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 0, 0) gboolean first_time = TRUE; GtkCssProvider *provider; @@ -417,22 +402,6 @@ static inline void force_no_focus_padding (GtkWidget *widget) first_time = FALSE; } -#else - gboolean first_time=TRUE; - - if (first_time) { - gtk_rc_parse_string ("\n" - " style \"charpick-applet-button-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " }\n" - "\n" - " widget \"*.charpick-applet-button\" style \"charpick-applet-button-style\"\n" - "\n"); - first_time = FALSE; - } -#endif gtk_widget_set_name (widget, "charpick-applet-button"); } @@ -457,9 +426,9 @@ build_table(charpick_data *p_curr_data) gtk_widget_destroy(p_curr_data->box); if (p_curr_data->panel_vertical) - box = gtk_vbox_new (FALSE, 0); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); else - box = gtk_hbox_new (FALSE, 0); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (box); p_curr_data->box = box; @@ -470,7 +439,6 @@ build_table(charpick_data *p_curr_data) switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (p_curr_data->applet))) { case MATE_PANEL_APPLET_ORIENT_DOWN: -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_MENU); break; case MATE_PANEL_APPLET_ORIENT_UP: @@ -481,18 +449,6 @@ build_table(charpick_data *p_curr_data) break; case MATE_PANEL_APPLET_ORIENT_RIGHT: arrow = gtk_image_new_from_icon_name ("pan-end-symbolic", GTK_ICON_SIZE_MENU); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); - break; - case MATE_PANEL_APPLET_ORIENT_UP: - arrow = gtk_arrow_new (GTK_ARROW_UP, GTK_SHADOW_OUT); - break; - case MATE_PANEL_APPLET_ORIENT_LEFT: - arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_OUT); - break; - case MATE_PANEL_APPLET_ORIENT_RIGHT: - arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_OUT); -#endif break; default: g_assert_not_reached (); @@ -543,11 +499,7 @@ build_table(charpick_data *p_curr_data) gtk_widget_set_tooltip_text (toggle_button[i], name); g_free (name); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (toggle_button[i], NULL, &req); -#else - gtk_widget_size_request (toggle_button[i], &req); -#endif max_width = MAX (max_width, req.width); max_height = MAX (max_height, req.height-2); @@ -563,22 +515,21 @@ build_table(charpick_data *p_curr_data) if (p_curr_data->panel_vertical) { size_ratio = p_curr_data->panel_size / max_width; - button_box = gtk_hbox_new (TRUE, 0); + button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); } else { size_ratio = p_curr_data->panel_size / max_height; - button_box = gtk_vbox_new (TRUE, 0); + button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); } + gtk_box_set_homogeneous (GTK_BOX (button_box), TRUE); gtk_box_pack_start (GTK_BOX (box), button_box, TRUE, TRUE, 0); size_ratio = MAX (size_ratio, 1); row_box = g_new0 (GtkWidget *, size_ratio); for (i=0; i < size_ratio; i++) { - if (!p_curr_data->panel_vertical) row_box[i] = gtk_hbox_new (TRUE, 0); - else row_box[i] = gtk_vbox_new (TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_box_set_homogeneous (GTK_BOX (button_box), TRUE); -#endif + if (!p_curr_data->panel_vertical) row_box[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + else row_box[i] = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_box_set_homogeneous (GTK_BOX (row_box[i]), TRUE); gtk_box_pack_start (GTK_BOX (button_box), row_box[i], TRUE, TRUE, 0); } diff --git a/charpick/properties.c b/charpick/properties.c index ac41ebd9..bf1dfd5a 100644 --- a/charpick/properties.c +++ b/charpick/properties.c @@ -15,11 +15,6 @@ #define CHARPICK_STOCK_EDIT "charpick-stock-edit" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - void register_stock_for_edit (void) { @@ -111,11 +106,11 @@ add_edit_dialog_create (charpick_data *curr_data, gchar *string, gchar *title) dbox = gtk_dialog_get_content_area(GTK_DIALOG (dialog)); - vbox = gtk_vbox_new (FALSE, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); label = gtk_label_new_with_mnemonic (_("_Palette:")); @@ -415,7 +410,7 @@ create_hig_catagory (GtkWidget *main_box, gchar *title) GtkWidget *label; gchar *tmp; - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (main_box), vbox, TRUE, TRUE, 0); tmp = g_strdup_printf ("<b>%s</b>", title); @@ -429,13 +424,13 @@ create_hig_catagory (GtkWidget *main_box, gchar *title) g_free (tmp); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); label = gtk_label_new (" "); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - vbox2 = gtk_vbox_new (FALSE, 6); + vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); return vbox2; @@ -453,13 +448,13 @@ static void default_chars_frame_create(charpick_data *curr_data) dbox = gtk_dialog_get_content_area(GTK_DIALOG (dialog)); - vbox = gtk_vbox_new (FALSE, 18); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0); vbox1 = create_hig_catagory (vbox, _("Character Palette")); - vbox3 = gtk_vbox_new (FALSE, 6); + vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (vbox1), vbox3, TRUE, TRUE, 0); label = gtk_label_new_with_mnemonic(_("_Palettes:")); @@ -471,12 +466,12 @@ static void default_chars_frame_create(charpick_data *curr_data) #endif gtk_widget_show(label); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox3), hbox, TRUE, TRUE, 0); scrolled = create_palettes_tree (curr_data, label); gtk_box_pack_start (GTK_BOX (hbox), scrolled, TRUE, TRUE, 0); - vbox2 = gtk_vbox_new (FALSE, 6); + vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); button = gtk_button_new_from_stock (GTK_STOCK_ADD); gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); diff --git a/command/command.c b/command/command.c index 3be3b2f2..0b1a4c91 100644 --- a/command/command.c +++ b/command/command.c @@ -48,10 +48,6 @@ #define GK_COMMAND_OUTPUT "Output" #define GK_COMMAND_ICON "Icon" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - typedef struct { MatePanelApplet *applet; @@ -126,11 +122,7 @@ static void command_settings_callback (GtkAction *action, CommandApplet *command_applet) { GtkDialog *dialog; -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid; -#else - GtkTable *table; -#endif GtkWidget *widget; GtkWidget *command; GtkWidget *interval; @@ -143,15 +135,9 @@ command_settings_callback (GtkAction *action, CommandApplet *command_applet) GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL)); -#if GTK_CHECK_VERSION (3, 0, 0) grid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_row_spacing (grid, 12); gtk_grid_set_column_spacing (grid, 12); -#else - table = GTK_TABLE (gtk_table_new (4, 2, FALSE)); - gtk_table_set_row_spacings (table, 12); - gtk_table_set_col_spacings (table, 12); -#endif gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 150); gtk_container_set_border_width (GTK_CONTAINER (dialog), 10); @@ -163,21 +149,10 @@ command_settings_callback (GtkAction *action, CommandApplet *command_applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 0, 1, 1); command = gtk_entry_new (); gtk_grid_attach (grid, command, 2, 0, 1, 1); -#else - gtk_table_attach (table, widget, 1, 2, 0, 1, - GTK_FILL, GTK_FILL, - 0, 0); - - command = gtk_entry_new (); - gtk_table_attach (table, command, 2, 3, 0, 1, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif widget = gtk_label_new (_("Interval (seconds):")); #if GTK_CHECK_VERSION (3, 16, 0) @@ -186,21 +161,10 @@ command_settings_callback (GtkAction *action, CommandApplet *command_applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 1, 1, 1); interval = gtk_spin_button_new_with_range (1.0, 600.0, 1.0); gtk_grid_attach (grid, interval, 2, 1, 1, 1); -#else - gtk_table_attach (table, widget, 1, 2, 1, 2, - GTK_FILL, GTK_FILL, - 0, 0); - - interval = gtk_spin_button_new_with_range (1.0, 600.0, 1.0); - gtk_table_attach (table, interval, 2, 3, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif widget = gtk_label_new (_("Maximum width (chars):")); #if GTK_CHECK_VERSION (3, 16, 0) @@ -209,7 +173,6 @@ command_settings_callback (GtkAction *action, CommandApplet *command_applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 2, 1, 1); width = gtk_spin_button_new_with_range(1.0, 100.0, 1.0); @@ -219,23 +182,6 @@ command_settings_callback (GtkAction *action, CommandApplet *command_applet) gtk_grid_attach (grid, showicon, 2, 3, 1, 1); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (grid), TRUE, TRUE, 0); -#else - gtk_table_attach (table, widget, 1, 2, 2, 3, - GTK_FILL, GTK_FILL, - 0, 0); - - width = gtk_spin_button_new_with_range(1.0, 100.0, 1.0); - gtk_table_attach (table, width, 2, 3, 2, 3, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); - - showicon = gtk_check_button_new_with_label (_("Show icon")); - gtk_table_attach (table, showicon, 2, 3, 3, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); - - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (table), TRUE, TRUE, 0); -#endif g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); @@ -404,7 +350,7 @@ command_applet_fill (MatePanelApplet* applet) command_applet->command = g_settings_get_string (command_applet->settings, COMMAND_KEY); command_applet->width = g_settings_get_int (command_applet->settings, WIDTH_KEY); - command_applet->box = GTK_BOX (gtk_hbox_new (FALSE, 0)); + command_applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); command_applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, 24)); command_applet->label = GTK_LABEL (gtk_label_new (ERROR_OUTPUT)); command_applet->timeout_id = 0; diff --git a/configure.ac b/configure.ac index 6d88360f..41dcde96 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl *************************************************************************** dnl *** configure.in for MATE-APPLETS *** dnl *************************************************************************** -AC_INIT(mate-applets, 1.16.0) +AC_INIT(mate-applets, 1.17.0) AC_PREREQ(2.59) AC_CONFIG_HEADERS(config.h) @@ -13,7 +13,8 @@ dnl *** Minimum library versions for MATE-APPLETS *** dnl *************************************************************************** GLIB_REQUIRED=2.36.0 GIO_REQUIRED=2.15.3 -LIBPANEL4_REQUIRED=1.7.0 +GTK_REQUIRED=3.14.0 +LIBPANEL4_REQUIRED=1.17.0 LIBGTOP_REQUIRED=2.12.0 LIBNOTIFY_REQUIRED=0.7.0 UPOWER_REQUIRED=0.9.4 @@ -21,6 +22,8 @@ DBUS_REQUIRED=1.1.2 DBUS_GLIB_REQUIRED=0.74 LIBXML_REQUIRED=2.5.0 POLKIT_REQUIRED=0.97 +LIBWNCK_REQUIRED=3.0.0 +GUCHARMAP_REQUIRED=3.0.0 dnl *************************************************************************** AM_MAINTAINER_MODE @@ -83,40 +86,6 @@ fi dnl *************************************************************************** dnl *************************************************************************** -dnl *** Check for GTK+ version to use *** -dnl *************************************************************************** -AC_MSG_CHECKING([which gtk+ version to compile against]) -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], - [case "$with_gtk" in - 2.0|3.0) ;; - *) AC_MSG_ERROR([invalid gtk version specified]) ;; - esac], - [with_gtk=2.0]) -AC_MSG_RESULT([$with_gtk]) - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - GTK_REQUIRED=2.24.0 - LIBWNCK_API_VERSION=1.0 - LIBWNCK_REQUIRED=2.30.0 - GUCHARMAP_API_VERSION=2 - GUCHARMAP_REQUIRED=2.32.1 - ;; - 3.0) GTK_API_VERSION=3.0 - GTK_REQUIRED=3.0.0 - LIBWNCK_API_VERSION=3.0 - LIBWNCK_REQUIRED=3.0.0 - GUCHARMAP_API_VERSION=2.90 - GUCHARMAP_REQUIRED=3.0.0 - ;; -esac -AC_SUBST(GTK_API_VERSION) - -dnl *************************************************************************** - - -dnl *************************************************************************** dnl *** Use pkg-config to check for dependencies *** dnl *************************************************************************** @@ -126,7 +95,7 @@ AC_SUBST(GIO_CFLAGS) AC_SUBST(GIO_LIBS) dnl -- Check for GTK+ 2.0 (required) ------------------------------------------ -PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) +PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED) AC_SUBST(GTK_FLAGS) AC_SUBST(GTK_LIBS) @@ -146,7 +115,7 @@ AC_SUBST(GTOP_APPLETS_LIBS) AM_CONDITIONAL(BUILD_GTOP_APPLETS, $build_gtop_applets) dnl -- check for libwnck (required) ------------------------------------------- -PKG_CHECK_MODULES(LIBWNCK, libwnck-$LIBWNCK_API_VERSION >= $LIBWNCK_REQUIRED,, +PKG_CHECK_MODULES(LIBWNCK, libwnck-3.0 >= $LIBWNCK_REQUIRED,, AC_MSG_ERROR([libwnck is required to build mate-applets.], 1)) AC_SUBST(LIBWNCK_CFLAGS) @@ -223,10 +192,10 @@ AC_SUBST(UPOWER_LIBS) dnl -- check for gucharmap (optional) ----------------------------------------- -PKG_CHECK_EXISTS([gucharmap-$GUCHARMAP_API_VERSION >= $GUCHARMAP_REQUIRED], +PKG_CHECK_EXISTS([gucharmap-2.90 >= $GUCHARMAP_REQUIRED], [have_gucharmap=yes], [have_gucharmap=no]) if test "$have_gucharmap" = "yes"; then - PKG_CHECK_MODULES([GUCHARMAP], [gucharmap-$GUCHARMAP_API_VERSION >= $GUCHARMAP_REQUIRED]) + PKG_CHECK_MODULES([GUCHARMAP], [gucharmap-2.90 >= $GUCHARMAP_REQUIRED]) AC_DEFINE([HAVE_GUCHARMAP], [1] ,[Gucharmap Available]) else AC_MSG_WARN([*** 'charpick' applet will be built without gucharmap support ***]) @@ -341,7 +310,7 @@ AC_ARG_ENABLE([stickynotes], enable_stickynotes=$enableval, enable_stickynotes=yes) if test "x$enable_stickynotes" = "xyes"; then - PKG_CHECK_MODULES(STICKYNOTES, gtksourceview-$GTK_API_VERSION, + PKG_CHECK_MODULES(STICKYNOTES, gtksourceview-3.0, have_gtksourceview=yes, have_gtksourceview=no) if test "x$enable_stickynotes" = "xyes" -a "x$have_gtksourceview" = "xno"; then @@ -646,8 +615,6 @@ mate-applets-$VERSION configure summary: Source code location: ${srcdir} Compiler: ${CC} - GTK+ version: ${GTK_API_VERSION} - Building: - accessx-status $HAVE_XKB - battstat $build_battstat_applet diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c index 629a8333..4600caec 100644 --- a/cpufreq/src/cpufreq-applet.c +++ b/cpufreq/src/cpufreq-applet.c @@ -39,11 +39,6 @@ #include "cpufreq-monitor-factory.h" #include "cpufreq-utils.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _CPUFreqApplet { MatePanelApplet base; @@ -107,14 +102,9 @@ static gboolean cpufreq_applet_key_press (GtkWidget *widget, GdkEventKey *event); static void cpufreq_applet_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -#if GTK_CHECK_VERSION (3, 0, 0) static void cpufreq_applet_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width); -#else -static void cpufreq_applet_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif static void cpufreq_applet_change_orient (MatePanelApplet *pa, MatePanelAppletOrient orient); static gboolean cpufreq_applet_factory (CPUFreqApplet *applet, @@ -231,11 +221,7 @@ cpufreq_applet_class_init (CPUFreqAppletClass *klass) gobject_class->dispose = cpufreq_applet_dispose; widget_class->size_allocate = cpufreq_applet_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = cpufreq_applet_get_preferred_width; -#else - widget_class->size_request = cpufreq_applet_size_request; -#endif widget_class->button_press_event = cpufreq_applet_button_press; widget_class->key_press_event = cpufreq_applet_key_press; @@ -317,11 +303,7 @@ cpufreq_applet_get_max_label_width (CPUFreqApplet *applet) available_freqs = cpufreq_monitor_get_available_frequencies (applet->monitor); while (available_freqs) { GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) gint label_width; -#else - GtkRequisition req; -#endif const gchar *text; gchar *freq_text; gint freq; @@ -331,14 +313,8 @@ cpufreq_applet_get_max_label_width (CPUFreqApplet *applet) freq_text = cpufreq_utils_get_frequency_label (freq); label = gtk_label_new (freq_text); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_width (applet->label, &label_width, NULL); width = MAX (width, label_width); -#endif -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_size_request (label, &req); - width = MAX (width, req.width); -#endif g_free (freq_text); gtk_widget_destroy (label); @@ -355,23 +331,14 @@ static gint cpufreq_applet_get_max_perc_width (CPUFreqApplet *applet) { GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) gint width; -#else - GtkRequisition req; -#endif if (applet->max_perc_width > 0) return applet->max_perc_width; label = gtk_label_new ("100%"); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_width (applet->label, &width,&width); applet->max_perc_width = width +20; /*for some reason width always comes up 2 characters*/ -#else - gtk_widget_size_request (label, &req); - applet->max_perc_width = req.width; -#endif gtk_widget_destroy (label); return applet->max_perc_width; @@ -381,45 +348,24 @@ static gint cpufreq_applet_get_max_unit_width (CPUFreqApplet *applet) { GtkWidget *label; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkRequisition req; -#endif gint w1, w2; if (applet->max_unit_width > 0) return applet->max_unit_width; label = gtk_label_new ("GHz"); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_width (applet->label, &w1, NULL); -#else - gtk_widget_size_request (label, &req); - w1 = req.width; -#endif gtk_label_set_text (GTK_LABEL (label), "MHz"); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_width (applet->label, &w2, NULL); -#else - gtk_widget_size_request (label, &req); - w2 = req.width; -#endif gtk_widget_destroy (label); -#if GTK_CHECK_VERSION (3, 0, 0) applet->max_unit_width = MAX (w1, w2)-1; -#else - applet->max_unit_width = MAX (w1, w2); -#endif return applet->max_unit_width; } static void -#if GTK_CHECK_VERSION (3, 0, 0) cpufreq_applet_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width) -#else -cpufreq_applet_size_request (GtkWidget *widget, GtkRequisition *requisition) -#endif { CPUFreqApplet *applet; gint labels_width = 0; @@ -427,10 +373,6 @@ cpufreq_applet_size_request (GtkWidget *widget, GtkRequisition *requisition) applet = CPUFREQ_APPLET (widget); -#if !GTK_CHECK_VERSION (3, 0, 0) - GTK_WIDGET_CLASS (cpufreq_applet_parent_class)->size_request (widget, requisition); -#endif - if (applet->orient == MATE_PANEL_APPLET_ORIENT_LEFT || applet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT) return; @@ -449,30 +391,17 @@ cpufreq_applet_size_request (GtkWidget *widget, GtkRequisition *requisition) } if (applet->show_icon) { -#if GTK_CHECK_VERSION (3, 0, 0) gint icon_width; gtk_widget_get_preferred_width (applet->icon, &icon_width, NULL); width = gtk_orientable_get_orientation (GTK_ORIENTABLE (applet->box)) == GTK_ORIENTATION_HORIZONTAL ? labels_width + icon_width + 2 : MAX (labels_width, icon_width + 2); -#else - GtkRequisition req; - - gtk_widget_size_request (applet->icon, &req); - width = GTK_IS_HBOX (applet->box) ? - labels_width + req.width + 2 : - MAX (labels_width, req.width + 2); -#endif } else { width = labels_width; } -#if GTK_CHECK_VERSION (3, 0, 0) *minimum_width = *natural_width = width; -#else - requisition->width = width; -#endif } static void @@ -490,11 +419,7 @@ cpufreq_applet_popup_position_menu (GtkMenu *menu, widget = GTK_WIDGET (gdata); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &requisition); -#endif gdk_window_get_origin (gtk_widget_get_window (widget), &menu_xpos, &menu_ypos); @@ -524,11 +449,7 @@ cpufreq_applet_popup_position_menu (GtkMenu *menu, *x = menu_xpos; *y = menu_ypos; -#if GTK_CHECK_VERSION (3, 0, 0) if (push_in) *push_in = FALSE; /*fix bottom panel menu rendering in gtk3*/ -#else - *push_in = TRUE; -#endif } static void @@ -551,7 +472,6 @@ cpufreq_applet_menu_popup (CPUFreqApplet *applet, if (!menu) return; -#if GTK_CHECK_VERSION (3, 0, 0) /*Set up theme and transparency support*/ GtkWidget *toplevel = gtk_widget_get_toplevel (menu); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ @@ -563,7 +483,7 @@ cpufreq_applet_menu_popup (CPUFreqApplet *applet, context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, cpufreq_applet_popup_position_menu, (gpointer) applet, @@ -910,11 +830,7 @@ cpufreq_applet_get_widget_size (CPUFreqApplet *applet, if (!gtk_widget_get_visible (widget)) return 0; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (widget, &req, NULL); -#else - gtk_widget_size_request (widget, &req); -#endif switch (applet->orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: @@ -977,7 +893,6 @@ cpufreq_applet_refresh (CPUFreqApplet *applet) } if (horizontal) { -#if GTK_CHECK_VERSION (3, 0, 0) applet->labels_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); if ((label_size + pixmap_size) <= panel_size) applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); @@ -993,23 +908,6 @@ cpufreq_applet_refresh (CPUFreqApplet *applet) } else { applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); applet->labels_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); -#else - applet->labels_box = gtk_hbox_new (FALSE, 2); - if ((label_size + pixmap_size) <= panel_size) - applet->box = gtk_vbox_new (FALSE, 2); - else - applet->box = gtk_hbox_new (FALSE, 2); - } else { - if (total_size <= panel_size) { - applet->box = gtk_hbox_new (FALSE, 2); - applet->labels_box = gtk_hbox_new (FALSE, 2); - } else if ((label_size + unit_label_size) <= (panel_size - size_step)) { - applet->box = gtk_vbox_new (FALSE, 2); - applet->labels_box = gtk_hbox_new (FALSE, 2); - } else { - applet->box = gtk_vbox_new (FALSE, 2); - applet->labels_box = gtk_vbox_new (FALSE, 2); -#endif } } diff --git a/drivemount/drive-button.c b/drivemount/drive-button.c index e94d45a4..d3fd2d58 100644 --- a/drivemount/drive-button.c +++ b/drivemount/drive-button.c @@ -29,9 +29,7 @@ #include "drive-button.h" #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gio/gdesktopappinfo.h> -#endif #include <string.h> @@ -70,7 +68,6 @@ drive_button_class_init (DriveButtonClass *class) GTK_WIDGET_CLASS(class)->button_press_event = drive_button_button_press; GTK_WIDGET_CLASS(class)->key_press_event = drive_button_key_press; -#if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; provider = gtk_css_provider_new (); @@ -85,22 +82,6 @@ drive_button_class_init (DriveButtonClass *class) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); - -#else - gtk_rc_parse_string ("\n" - " style \"drive-button-style\"\n" - " {\n" - " GtkWidget::focus-line-width=0\n" - " GtkWidget::focus-padding=0\n" - " bg_pixmap[NORMAL] = \"<parent>\"\n" - " bg_pixmap[ACTIVE] = \"<parent>\"\n" - " bg_pixmap[PRELIGHT] = \"<parent>\"\n" - " bg_pixmap[INSENSITIVE] = \"<parent>\"\n" - " }\n" - "\n" - " class \"DriveButton\" style \"drive-button-style\"\n" - "\n"); -#endif } static void @@ -202,11 +183,7 @@ position_menu (GtkMenu *menu, gint *x, gint *y, direction = gtk_widget_get_direction (widget); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); -#else - gtk_widget_get_requisition (GTK_WIDGET (menu), &requisition); -#endif twidth = requisition.width; theight = requisition.height; @@ -383,13 +360,8 @@ drive_button_update (gpointer user_data) g_free (display_name); /* base the icon size on the desired button size */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req); gtk_widget_get_preferred_size (gtk_bin_get_child (GTK_BIN (self)), NULL, &image_req); -#else - gtk_widget_size_request (GTK_WIDGET (self), &button_req); - gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (self)), &image_req); -#endif width = self->icon_size - (button_req.width - image_req.width); height = self->icon_size - (button_req.height - image_req.height); @@ -401,11 +373,7 @@ drive_button_update (gpointer user_data) if (icon_info) { pixbuf = gtk_icon_info_load_icon (icon_info, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (icon_info); -#else - gtk_icon_info_free (icon_info); -#endif } g_object_unref (icon); @@ -422,11 +390,7 @@ drive_button_update (gpointer user_data) gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), pixbuf); g_object_unref (pixbuf); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req); -#else - gtk_widget_size_request (GTK_WIDGET (self), &button_req); -#endif return FALSE; } @@ -554,60 +518,31 @@ open_drive (DriveButton *self, GtkWidget *item) GdkScreen *screen; GtkWidget *dialog; GError *error = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) GFile *file = NULL; GList *files = NULL; GdkAppLaunchContext *launch_context; GAppInfo *app_info; -#else - char *argv[3] = { "caja", NULL, NULL }; - - screen = gtk_widget_get_screen (GTK_WIDGET (self)); -#endif if (self->volume) { GMount *mount; mount = g_volume_get_mount (self->volume); if (mount) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GFile *file; -#endif - file = g_mount_get_root (mount); - -#if !GTK_CHECK_VERSION (3, 0, 0) - argv[1] = g_file_get_uri (file); - g_object_unref(file); -#endif - g_object_unref(mount); } } else if (self->mount) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GFile *file; -#endif - file = g_mount_get_root (self->mount); -#if !GTK_CHECK_VERSION (3, 0, 0) - argv[1] = g_file_get_uri (file); - g_object_unref(file); -#endif } else g_return_if_reached(); -#if GTK_CHECK_VERSION (3, 0, 0) app_info = g_app_info_get_default_for_type("inode/directory", FALSE); if (!app_info) app_info = G_APP_INFO (g_desktop_app_info_new ("caja.desktop")); if (app_info) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display = gtk_widget_get_display (item); launch_context = gdk_display_get_app_launch_context (display); -#else - launch_context = gdk_app_launch_context_new (); -#endif screen = gtk_widget_get_screen (GTK_WIDGET (self)); gdk_app_launch_context_set_screen (launch_context, screen); files = g_list_prepend (files, file); @@ -621,21 +556,11 @@ open_drive (DriveButton *self, GtkWidget *item) } if (!app_info || error) { -#else - if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, &error)) { -#endif dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, -#if GTK_CHECK_VERSION (3, 0, 0) _("Cannot execute Caja")); -#else - _("Cannot execute '%s'"), - argv[0]); -#endif if (error) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), error->message, NULL); else @@ -645,11 +570,8 @@ open_drive (DriveButton *self, GtkWidget *item) gtk_widget_show (dialog); g_error_free (error); } -#if GTK_CHECK_VERSION (3, 0, 0) + g_object_unref(file); -#else - g_free (argv[1]); -#endif } /* copied from mate-volume-manager/src/manager.c maybe there is a better way than @@ -994,7 +916,6 @@ drive_button_ensure_popup (DriveButton *self) gtk_container_add (GTK_CONTAINER (self->popup_menu), item); } -#if GTK_CHECK_VERSION (3, 0, 0) /*Set up custom theme and transparency support */ GtkWidget *toplevel = gtk_widget_get_toplevel (self->popup_menu); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ @@ -1006,5 +927,4 @@ drive_button_ensure_popup (DriveButton *self) context = gtk_widget_get_style_context (GTK_WIDGET(toplevel)); gtk_style_context_add_class(context,"gnome-panel-menu-bar"); gtk_style_context_add_class(context,"mate-panel-menu-bar"); -#endif } diff --git a/drivemount/drive-list.c b/drivemount/drive-list.c index a1018398..78dd2e66 100644 --- a/drivemount/drive-list.c +++ b/drivemount/drive-list.c @@ -30,11 +30,7 @@ #include "drive-button.h" #include <glib/gi18n.h> -#if GTK_CHECK_VERSION(3, 0, 0) G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_GRID); -#else -G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_TABLE); -#endif static GVolumeMonitor *volume_monitor = NULL; @@ -84,12 +80,8 @@ drive_list_init (DriveList *self) { GList *volumes, *mounts, *tmp; -#if GTK_CHECK_VERSION(3, 0, 0) gtk_grid_set_column_homogeneous (GTK_GRID (self), TRUE); gtk_grid_set_row_homogeneous (GTK_GRID (self), TRUE); -#else - gtk_table_set_homogeneous (GTK_TABLE (self), TRUE); -#endif self->volumes = g_hash_table_new (NULL, NULL); self->mounts = g_hash_table_new (NULL, NULL); @@ -248,36 +240,16 @@ relayout_buttons (gpointer data) if (self->orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_container_child_set (GTK_CONTAINER (self), button, -#if GTK_CHECK_VERSION(3, 0, 0) "left-attach", i + 1, "top-attach", 0, "width", 1, "height", 1, NULL); -#else - "left_attach", i, "right_attach", i+1, - "top_attach", 0, "bottom_attach", 1, - "x_options", GTK_FILL, - "y_options", GTK_FILL, - NULL); -#endif } else { gtk_container_child_set (GTK_CONTAINER (self), button, -#if GTK_CHECK_VERSION(3, 0, 0) "left-attach", 0, "top-attach", i + 1, "width", 1, "height", 1, NULL); -#else - "left_attach", 0, "right_attach", 1, - "top_attach", i, "bottom_attach", i+1, - "x_options", GTK_FILL, - "y_options", GTK_FILL, - NULL); -#endif } } -#if !GTK_CHECK_VERSION(3, 0, 0) - /* shrink wrap the table */ - gtk_table_resize (GTK_TABLE (self), 1, 1); -#endif return FALSE; } diff --git a/drivemount/drive-list.h b/drivemount/drive-list.h index 76693ca7..690e0c4b 100644 --- a/drivemount/drive-list.h +++ b/drivemount/drive-list.h @@ -39,11 +39,7 @@ typedef struct _DriveListClass DriveListClass; struct _DriveList { -#if GTK_CHECK_VERSION(3, 0, 0) GtkGrid parent; -#else - GtkTable parent; -#endif GHashTable *volumes; GHashTable *mounts; @@ -56,11 +52,7 @@ struct _DriveList struct _DriveListClass { -#if GTK_CHECK_VERSION(3, 0, 0) GtkGridClass parent_class; -#else - GtkTableClass parent_class; -#endif }; GType drive_list_get_type (void); diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c index 28904ee7..196af363 100644 --- a/drivemount/drivemount.c +++ b/drivemount/drivemount.c @@ -79,11 +79,7 @@ static void change_background (MatePanelApplet *applet, MatePanelAppletBackgroundType type, GdkColor *colour, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_pattern_t *pattern, -#else - GdkPixmap *pixmap, -#endif DriveList *drivelist) { switch (type) { diff --git a/geyes/geyes.c b/geyes/geyes.c index 81d7b2d3..5a49d129 100644 --- a/geyes/geyes.c +++ b/geyes/geyes.c @@ -26,12 +26,6 @@ #define UPDATE_TIMEOUT 100 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static gfloat gtk_align_to_gfloat (GtkAlign align) { @@ -47,7 +41,6 @@ gtk_align_to_gfloat (GtkAlign align) return 0.0; } } -#endif /* TODO - Optimize this a bit */ static void @@ -68,13 +61,8 @@ calculate_pupil_xy (EyesApplet *eyes_applet, gtk_widget_get_allocation (GTK_WIDGET(widget), &allocation); width = allocation.width; height = allocation.height; -#if GTK_CHECK_VERSION (3, 0, 0) - xalign = gtk_align_to_gfloat (gtk_widget_get_halign (widget)); yalign = gtk_align_to_gfloat (gtk_widget_get_valign (widget)); -#else - gtk_misc_get_alignment(GTK_MISC(widget), &xalign, &yalign); -#endif nx = x - MAX(width - eyes_applet->eye_width, 0) * xalign - eyes_applet->eye_width / 2; ny = y - MAX(height- eyes_applet->eye_height, 0) * yalign - eyes_applet->eye_height / 2; @@ -135,7 +123,6 @@ draw_eye (EyesApplet *eyes_applet, static gint timer_cb (EyesApplet *eyes_applet) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; #if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; @@ -143,12 +130,10 @@ timer_cb (EyesApplet *eyes_applet) GdkDeviceManager *device_manager; GdkDevice *device; #endif -#endif gint x, y; gint pupil_x, pupil_y; gint i; -#if GTK_CHECK_VERSION (3, 0, 0) display = gtk_widget_get_display (GTK_WIDGET (eyes_applet->applet)); #if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); @@ -156,11 +141,9 @@ timer_cb (EyesApplet *eyes_applet) device_manager = gdk_display_get_device_manager (display); device = gdk_device_manager_get_client_pointer (device_manager); #endif -#endif for (i = 0; i < eyes_applet->num_eyes; i++) { if (gtk_widget_get_realized (eyes_applet->eyes[i])) { -#if GTK_CHECK_VERSION (3, 0, 0) #if GTK_CHECK_VERSION (3, 20, 0) gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]), gdk_seat_get_pointer (seat), @@ -168,9 +151,6 @@ timer_cb (EyesApplet *eyes_applet) #else gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]), device, &x, &y, NULL); #endif -#else - gtk_widget_get_pointer (eyes_applet->eyes[i], &x, &y); -#endif if ((x != eyes_applet->pointer_last_x[i]) || (y != eyes_applet->pointer_last_y[i])) { calculate_pupil_xy (eyes_applet, x, y, &pupil_x, &pupil_y, eyes_applet->eyes[i]); @@ -242,7 +222,7 @@ setup_eyes (EyesApplet *eyes_applet) { int i; - eyes_applet->hbox = gtk_hbox_new (FALSE, 0); + eyes_applet->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (eyes_applet->vbox), eyes_applet->hbox, TRUE, TRUE, 0); eyes_applet->eyes = g_new0 (GtkWidget *, eyes_applet->num_eyes); @@ -267,7 +247,6 @@ setup_eyes (EyesApplet *eyes_applet) 0); if ((eyes_applet->num_eyes != 1) && (i == 0)) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (eyes_applet->eyes[i], GTK_ALIGN_END); gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER); } @@ -278,15 +257,6 @@ setup_eyes (EyesApplet *eyes_applet) else { gtk_widget_set_halign (eyes_applet->eyes[i], GTK_ALIGN_CENTER); gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER); -#else - gtk_misc_set_alignment (GTK_MISC (eyes_applet->eyes[i]), 1.0, 0.5); - } - else if ((eyes_applet->num_eyes != 1) && (i == eyes_applet->num_eyes - 1)) { - gtk_misc_set_alignment (GTK_MISC (eyes_applet->eyes[i]), 0.0, 0.5); - } - else { - gtk_misc_set_alignment (GTK_MISC (eyes_applet->eyes[i]), 0.5, 0.5); -#endif } gtk_widget_realize (eyes_applet->eyes[i]); @@ -319,7 +289,7 @@ create_eyes (MatePanelApplet *applet) EyesApplet *eyes_applet = g_new0 (EyesApplet, 1); eyes_applet->applet = applet; - eyes_applet->vbox = gtk_vbox_new (FALSE, 0); + eyes_applet->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); eyes_applet->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.geyes"); diff --git a/geyes/themes.c b/geyes/themes.c index b2167288..3af628c8 100644 --- a/geyes/themes.c +++ b/geyes/themes.c @@ -29,11 +29,6 @@ #define NUM_THEME_DIRECTORIES 2 #define HIG_IDENTATION " " -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static char *theme_directories[NUM_THEME_DIRECTORIES]; enum { @@ -301,18 +296,18 @@ properties_cb (GtkAction *action, G_CALLBACK (presponse_cb), eyes_applet); - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pbox))), vbox, TRUE, TRUE, 0); - categories_vbox = gtk_vbox_new (FALSE, 18); + categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_box_pack_start (GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0); gtk_widget_show (categories_vbox); - category_vbox = gtk_vbox_new (FALSE, 6); + category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0); gtk_widget_show (category_vbox); @@ -328,7 +323,7 @@ properties_cb (GtkAction *action, gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0); g_free (title); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -337,7 +332,7 @@ properties_cb (GtkAction *action, gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0); gtk_widget_show (indent); - control_vbox = gtk_vbox_new (FALSE, 6); + control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0); gtk_widget_show (control_vbox); diff --git a/invest-applet/invest/__init__.py b/invest-applet/invest/__init__.py index 8835f7d6..0bc70f94 100644 --- a/invest-applet/invest/__init__.py +++ b/invest-applet/invest/__init__.py @@ -7,7 +7,7 @@ import datetime from defs import * import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject diff --git a/invest-applet/invest/about.py b/invest-applet/invest/about.py index 87feaf92..97e33f27 100644 --- a/invest-applet/invest/about.py +++ b/invest-applet/invest/about.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- from os.path import join from gettext import gettext as _ -from mate_invest.defs import VERSION, GTK_API_VERSION +from mate_invest.defs import VERSION import mate_invest import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GdkPixbuf diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py index 117faa6e..82001ed3 100644 --- a/invest-applet/invest/applet.py +++ b/invest-applet/invest/applet.py @@ -3,7 +3,7 @@ from os.path import * import mate_invest.defs import gi -gi.require_version("Gtk", mate_invest.defs.GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk @@ -135,18 +135,10 @@ class InvestmentsListWindow(Gtk.Window): #(wx, wy) = self.get_origin() window = self.applet.get_window() - if GTK_API_VERSION == '3.0': - screen = window.get_screen() - monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (window)) - (ret, ax, ay) = window.get_origin() - (ignored, ignored, aw, ah) = window.get_geometry() - else: - screen = self.applet.get_screen() - monitor = Gdk.Rectangle(0, 0, 0, 0) - ax = ay = 0 - self.applet.window.get_origin(ax, ay) - (aw, ah) = self.applet.window.get_size () - screen.get_monitor_geometry (screen.get_monitor_at_window (self.applet.window), monitor) + screen = window.get_screen() + monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (window)) + (ret, ax, ay) = window.get_origin() + (ignored, ignored, aw, ah) = window.get_geometry() (ww, wh) = self.get_size() diff --git a/invest-applet/invest/chart.py b/invest-applet/invest/chart.py index e12424a6..eb5322cb 100644 --- a/invest-applet/invest/chart.py +++ b/invest-applet/invest/chart.py @@ -1,8 +1,7 @@ #!/usr/bin/env python -from mate_invest.defs import GTK_API_VERSION import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GdkPixbuf diff --git a/invest-applet/invest/defs.py.in b/invest-applet/invest/defs.py.in index 41efe69a..9a39484f 100644 --- a/invest-applet/invest/defs.py.in +++ b/invest-applet/invest/defs.py.in @@ -7,4 +7,3 @@ GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@" MATELOCALEDIR = "@MATELOCALEDIR@" BUILDERDIR = "@BUILDERDIR@" PKGDATADIR = "@PKGDATADIR@" -GTK_API_VERSION = "@GTK_API_VERSION@" diff --git a/invest-applet/invest/help.py b/invest-applet/invest/help.py index 4a6b1cd3..ec0a6dbe 100644 --- a/invest-applet/invest/help.py +++ b/invest-applet/invest/help.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from mate_invest.defs import GTK_API_VERSION import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk diff --git a/invest-applet/invest/invest-applet.py b/invest-applet/invest/invest-applet.py index b8d5b5d5..b1e10578 100755 --- a/invest-applet/invest/invest-applet.py +++ b/invest-applet/invest/invest-applet.py @@ -2,7 +2,7 @@ import mate_invest.defs import gi -gi.require_version("Gtk", mate_invest.GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import GObject from gi.repository import MatePanelApplet diff --git a/invest-applet/invest/mate-invest-chart b/invest-applet/invest/mate-invest-chart index 78653479..6c3ed184 100755 --- a/invest-applet/invest/mate-invest-chart +++ b/invest-applet/invest/mate-invest-chart @@ -3,7 +3,7 @@ import sys, mate_invest.chart import gi -gi.require_version("Gtk", mate_invest.defs.GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk # Prepare i18n diff --git a/invest-applet/invest/preferences.py b/invest-applet/invest/preferences.py index 48fb0169..40cd72f3 100644 --- a/invest-applet/invest/preferences.py +++ b/invest-applet/invest/preferences.py @@ -2,9 +2,8 @@ from gettext import gettext as _ import locale from os.path import join -from mate_invest.defs import GTK_API_VERSION import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import GObject import mate_invest diff --git a/invest-applet/invest/quotes.py b/invest-applet/invest/quotes.py index 4fba6bfa..5331e007 100644 --- a/invest-applet/invest/quotes.py +++ b/invest-applet/invest/quotes.py @@ -1,8 +1,7 @@ from os.path import join, getmtime -from mate_invest.defs import GTK_API_VERSION import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GdkPixbuf @@ -474,5 +473,3 @@ class QuoteUpdater(Gtk.ListStore): break return res -#if Gtk.pygtk_version < (2,8,0): -# GObject.type_register(QuoteUpdater) diff --git a/invest-applet/invest/widgets.py b/invest-applet/invest/widgets.py index a0319034..8d15a5ed 100644 --- a/invest-applet/invest/widgets.py +++ b/invest-applet/invest/widgets.py @@ -1,9 +1,8 @@ import os, time from os.path import * -from mate_invest.defs import GTK_API_VERSION import gi -gi.require_version("Gtk", GTK_API_VERSION) +gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject diff --git a/mateweather/mateweather-applet.c b/mateweather/mateweather-applet.c index 9d774e55..88840803 100644 --- a/mateweather/mateweather-applet.c +++ b/mateweather/mateweather-applet.c @@ -41,11 +41,6 @@ #define MAX_CONSECUTIVE_FAULTS (3) -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static void about_cb (GtkAction *action, MateWeatherApplet *gw_applet) { @@ -152,12 +147,8 @@ static void place_widgets (MateWeatherApplet *gw_applet) gw_applet->image = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_BUTTON); if (icon_name != NULL) { -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_show (gw_applet->image); gtk_widget_get_preferred_size (gw_applet->image, &req, NULL); -#else - gtk_widget_size_request(gw_applet->image, &req); -#endif if (horizontal) total_size += req.height; else @@ -173,12 +164,8 @@ static void place_widgets (MateWeatherApplet *gw_applet) gtk_label_set_text(GTK_LABEL(gw_applet->label), temp); /* Check the label size to determine box layout */ -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_show (gw_applet->label); gtk_widget_get_preferred_size (gw_applet->label, &req, NULL); -#else - gtk_widget_size_request(gw_applet->label, &req); -#endif if (horizontal) total_size += req.height; else @@ -189,13 +176,13 @@ static void place_widgets (MateWeatherApplet *gw_applet) gtk_widget_destroy (gw_applet->box); if (horizontal && (total_size <= panel_size)) - gw_applet->box = gtk_vbox_new(FALSE, 0); + gw_applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); else if (horizontal && (total_size > panel_size)) - gw_applet->box = gtk_hbox_new(FALSE, 2); + gw_applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); else if (!horizontal && (total_size <= panel_size)) - gw_applet->box = gtk_hbox_new(FALSE, 2); + gw_applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); else - gw_applet->box = gtk_vbox_new(FALSE, 0); + gw_applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); /* Rebuild the applet it's visual area */ gtk_container_add (GTK_CONTAINER (gw_applet->container), gw_applet->box); diff --git a/mateweather/mateweather-dialog.c b/mateweather/mateweather-dialog.c index 30e5a042..dc14080d 100644 --- a/mateweather/mateweather-dialog.c +++ b/mateweather/mateweather-dialog.c @@ -27,11 +27,6 @@ #include "mateweather-pref.h" #include "mateweather-dialog.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _MateWeatherDialogPrivate { GtkWidget* cond_location; GtkWidget* cond_update; @@ -156,11 +151,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) GtkWidget *weather_vbox; GtkWidget *weather_notebook; GtkWidget *cond_hbox; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *cond_grid; -#else - GtkWidget *cond_table; -#endif GtkWidget *cond_location_lbl; GtkWidget *cond_update_lbl; GtkWidget *cond_temp_lbl; @@ -220,12 +211,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) gtk_widget_show (weather_notebook); gtk_box_pack_start (GTK_BOX (weather_vbox), weather_notebook, TRUE, TRUE, 0); - cond_hbox = gtk_hbox_new (FALSE, 2); + cond_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_widget_show (cond_hbox); gtk_container_add (GTK_CONTAINER (weather_notebook), cond_hbox); gtk_container_set_border_width (GTK_CONTAINER (cond_hbox), 4); -#if GTK_CHECK_VERSION (3, 0, 0) cond_grid = gtk_grid_new (); gtk_widget_show (cond_grid); gtk_box_pack_start (GTK_BOX (cond_hbox), cond_grid, TRUE, TRUE, 0); @@ -236,20 +226,6 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_location_lbl = gtk_label_new (_("City:")); gtk_widget_show (cond_location_lbl); gtk_grid_attach (GTK_GRID (cond_grid), cond_location_lbl, 0, 0, 1, 1); -#else - cond_table = gtk_table_new (13, 2, FALSE); - gtk_widget_show (cond_table); - gtk_box_pack_start (GTK_BOX (cond_hbox), cond_table, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (cond_table), 12); - gtk_table_set_row_spacings (GTK_TABLE (cond_table), 6); - gtk_table_set_col_spacings (GTK_TABLE (cond_table), 12); - - cond_location_lbl = gtk_label_new (_("City:")); - gtk_widget_show (cond_location_lbl); - gtk_table_attach (GTK_TABLE (cond_table), cond_location_lbl, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_location_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_location_lbl), 0.0); @@ -259,13 +235,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_update_lbl = gtk_label_new (_("Last update:")); gtk_widget_show (cond_update_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_update_lbl, 0, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_update_lbl, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_update_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_update_lbl), 0.0); @@ -275,13 +245,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_cond_lbl = gtk_label_new (_("Conditions:")); gtk_widget_show (cond_cond_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_cond_lbl, 0, 2, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_cond_lbl, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_cond_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_cond_lbl), 0.0); @@ -291,13 +255,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sky_lbl = gtk_label_new (_("Sky:")); gtk_widget_show (cond_sky_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_sky_lbl, 0, 3, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_sky_lbl, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_sky_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sky_lbl), 0.0); @@ -307,13 +265,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_temp_lbl = gtk_label_new (_("Temperature:")); gtk_widget_show (cond_temp_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_temp_lbl, 0, 4, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_temp_lbl, 0, 1, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_temp_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_temp_lbl), 0.0); @@ -323,13 +275,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_apparent_lbl = gtk_label_new (_("Feels like:")); gtk_widget_show (cond_apparent_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_apparent_lbl, 0, 5, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_apparent_lbl, 0, 1, 5, 6, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_apparent_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_apparent_lbl), 0.0); @@ -339,13 +285,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_dew_lbl = gtk_label_new (_("Dew point:")); gtk_widget_show (cond_dew_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_dew_lbl, 0, 6, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_dew_lbl, 0, 1, 6, 7, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_dew_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_dew_lbl), 0.0); @@ -355,13 +295,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_humidity_lbl = gtk_label_new (_("Relative humidity:")); gtk_widget_show (cond_humidity_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_humidity_lbl, 0, 7, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_humidity_lbl, 0, 1, 7, 8, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_humidity_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_humidity_lbl), 0.0); @@ -371,13 +305,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_wind_lbl = gtk_label_new (_("Wind:")); gtk_widget_show (cond_wind_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_wind_lbl, 0, 8, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_wind_lbl, 0, 1, 8, 9, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_wind_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_wind_lbl), 0.0); @@ -387,13 +315,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_pressure_lbl = gtk_label_new (_("Pressure:")); gtk_widget_show (cond_pressure_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_pressure_lbl, 0, 9, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_pressure_lbl, 0, 1, 9, 10, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_pressure_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_pressure_lbl), 0.0); @@ -403,13 +325,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_vis_lbl = gtk_label_new (_("Visibility:")); gtk_widget_show (cond_vis_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_vis_lbl, 0, 10, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_vis_lbl, 0, 1, 10, 11, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_vis_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_vis_lbl), 0.0); @@ -419,13 +335,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sunrise_lbl = gtk_label_new (_("Sunrise:")); gtk_widget_show (cond_sunrise_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_sunrise_lbl, 0, 11, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_sunrise_lbl, 0, 1, 11, 12, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_sunrise_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sunrise_lbl), 0.0); @@ -435,13 +345,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sunset_lbl = gtk_label_new (_("Sunset:")); gtk_widget_show (cond_sunset_lbl); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), cond_sunset_lbl, 0, 12, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), cond_sunset_lbl, 0, 1, 12, 13, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_justify (GTK_LABEL (cond_sunset_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sunset_lbl), 0.0); @@ -451,13 +355,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_location = gtk_label_new (""); gtk_widget_show (priv->cond_location); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_location, 1, 0, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_location, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_location), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_location), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -468,13 +366,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_update = gtk_label_new (""); gtk_widget_show (priv->cond_update); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_update, 1, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_update, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_update), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_update), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -485,13 +377,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_cond = gtk_label_new (""); gtk_widget_show (priv->cond_cond); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_cond, 1, 2, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_cond, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_cond), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_cond), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -502,13 +388,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sky = gtk_label_new (""); gtk_widget_show (priv->cond_sky); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sky, 1, 3, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sky, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sky), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sky), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -519,13 +399,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_temp = gtk_label_new (""); gtk_widget_show (priv->cond_temp); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_temp, 1, 4, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_temp, 1, 2, 4, 5, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_temp), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_temp), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -536,13 +410,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_apparent = gtk_label_new (""); gtk_widget_show (priv->cond_apparent); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_apparent, 1, 5, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_apparent, 1, 2, 5, 6, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_apparent), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_apparent), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -553,13 +421,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_dew = gtk_label_new (""); gtk_widget_show (priv->cond_dew); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_dew, 1, 6, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_dew, 1, 2, 6, 7, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_dew), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_dew), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -570,13 +432,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_humidity = gtk_label_new (""); gtk_widget_show (priv->cond_humidity); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_humidity, 1, 7, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_humidity, 1, 2, 7, 8, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_humidity), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_humidity), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -587,13 +443,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_wind = gtk_label_new (""); gtk_widget_show (priv->cond_wind); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_wind, 1, 8, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_wind, 1, 2, 8, 9, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_wind), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_wind), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -604,13 +454,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_pressure = gtk_label_new (""); gtk_widget_show (priv->cond_pressure); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_pressure, 1, 9, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_pressure, 1, 2, 9, 10, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_pressure), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_pressure), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -621,13 +465,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_vis = gtk_label_new (""); gtk_widget_show (priv->cond_vis); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_vis, 1, 10, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_vis, 1, 2, 10, 11, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_vis), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_vis), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -638,13 +476,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sunrise = gtk_label_new (""); gtk_widget_show (priv->cond_sunrise); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sunrise, 1, 11, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sunrise, 1, 2, 11, 12, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sunrise), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sunrise), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -655,13 +487,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sunset = gtk_label_new (""); gtk_widget_show (priv->cond_sunset); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sunset, 1, 12, 1, 1); -#else - gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sunset, 1, 2, 12, 13, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); -#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sunset), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sunset), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -685,7 +511,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) if (gw_applet->mateweather_pref.location->zone_valid) { - forecast_hbox = gtk_hbox_new(FALSE, 0); + forecast_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width (GTK_CONTAINER (forecast_hbox), 12); gtk_widget_show (forecast_hbox); @@ -717,7 +543,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) radar_note_lbl = gtk_label_new_with_mnemonic (_("Radar Map")); gtk_widget_show (radar_note_lbl); - radar_vbox = gtk_vbox_new (FALSE, 6); + radar_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_show (radar_vbox); gtk_notebook_append_page (GTK_NOTEBOOK (weather_notebook), radar_vbox, radar_note_lbl); gtk_container_set_border_width (GTK_CONTAINER (radar_vbox), 6); @@ -734,11 +560,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) ebox = gtk_event_box_new (); gtk_widget_show (ebox); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (imagescroll_window),ebox); -#else - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(imagescroll_window),ebox); -#endif gtk_box_pack_start (GTK_BOX (radar_vbox), imagescroll_window, TRUE, TRUE, 0); gtk_widget_show (priv->radar_image); gtk_widget_show (imagescroll_window); @@ -824,11 +646,7 @@ void mateweather_dialog_update(MateWeatherDialog* dialog) if (gw_applet->mateweather_pref.location->zone_valid) { font_desc = get_system_monospace_font (); if (font_desc) { -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (priv->forecast_text, font_desc); -#else - gtk_widget_modify_font (priv->forecast_text, font_desc); -#endif pango_font_description_free (font_desc); } diff --git a/mateweather/mateweather-pref.c b/mateweather/mateweather-pref.c index d2b31c0b..dc9338d0 100644 --- a/mateweather/mateweather-pref.c +++ b/mateweather/mateweather-pref.c @@ -37,11 +37,6 @@ #define NEVER_SENSITIVE "never_sensitive" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _MateWeatherPrefPrivate { GtkWidget* basic_temp_combo; GtkWidget* basic_speed_combo; @@ -553,7 +548,7 @@ static GtkWidget* create_hig_category(GtkWidget* main_box, gchar* title) GtkWidget*label; gchar* tmp; - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 0); tmp = g_strdup_printf ("<b>%s</b>", title); @@ -567,13 +562,13 @@ static GtkWidget* create_hig_category(GtkWidget* main_box, gchar* title) g_free (tmp); gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (" "); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - vbox2 = gtk_vbox_new (FALSE, 6); + vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); return vbox2; @@ -802,11 +797,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) GtkWidget* pres_combo; GtkWidget* dist_label; GtkWidget* dist_combo; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget* unit_grid; -#else - GtkWidget* unit_table; -#endif GtkWidget* pref_find_label; GtkWidget* pref_find_hbox; GtkWidget* image; @@ -833,7 +824,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) * General settings page. */ - pref_basic_vbox = gtk_vbox_new (FALSE, 18); + pref_basic_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_container_set_border_width (GTK_CONTAINER (pref_basic_vbox), 12); gtk_container_add (GTK_CONTAINER (pref_notebook), pref_basic_vbox); @@ -971,7 +962,6 @@ static void mateweather_pref_create(MateWeatherPref* pref) if ( ! g_settings_is_writable (pref->priv->applet->settings, "distance-unit")) hard_set_sensitive (pref->priv->basic_dist_combo, FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) unit_grid = gtk_grid_new (); gtk_grid_set_row_spacing(GTK_GRID(unit_grid), 6); gtk_grid_set_column_spacing(GTK_GRID(unit_grid), 12); @@ -988,20 +978,6 @@ static void mateweather_pref_create(MateWeatherPref* pref) gtk_grid_attach(GTK_GRID(unit_grid), dist_label, 0, 3, 1, 1); gtk_grid_attach(GTK_GRID(unit_grid), dist_combo, 1, 3, 1, 1); gtk_widget_show(unit_grid); -#else - unit_table = gtk_table_new(5, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(unit_table), 6); - gtk_table_set_col_spacings(GTK_TABLE(unit_table), 12); - gtk_table_attach(GTK_TABLE(unit_table), temp_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(unit_table), temp_combo, 1, 2, 0, 1); - gtk_table_attach(GTK_TABLE(unit_table), speed_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(unit_table), speed_combo, 1, 2, 1, 2); - gtk_table_attach(GTK_TABLE(unit_table), pres_label, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(unit_table), pres_combo, 1, 2, 2, 3); - gtk_table_attach(GTK_TABLE(unit_table), dist_label, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(unit_table), dist_combo, 1, 2, 3, 4); - gtk_widget_show(unit_table); -#endif g_signal_connect (temp_combo, "changed", G_CALLBACK (temp_combo_changed_cb), pref); g_signal_connect (speed_combo, "changed", G_CALLBACK (speed_combo_changed_cb), pref); @@ -1019,7 +995,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) hard_set_sensitive(pref->priv->basic_radar_btn, FALSE); } - radar_toggle_hbox = gtk_hbox_new(FALSE, 12); + radar_toggle_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_show(radar_toggle_hbox); label = gtk_label_new (" "); @@ -1037,7 +1013,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) hard_set_sensitive (pref->priv->basic_radar_url_btn, FALSE); } - pref->priv->basic_radar_url_hbox = gtk_hbox_new (FALSE, 12); + pref->priv->basic_radar_url_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_show (pref->priv->basic_radar_url_hbox); label = gtk_label_new (" "); @@ -1071,7 +1047,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) frame = create_hig_category (pref_basic_vbox, _("Update")); - pref_basic_update_hbox = gtk_hbox_new (FALSE, 12); + pref_basic_update_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); pref_basic_update_lbl = gtk_label_new_with_mnemonic (_("_Automatically update every:")); gtk_widget_show (pref_basic_update_lbl); @@ -1095,7 +1071,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) hard_set_sensitive (pref_basic_update_sec_lbl, FALSE); } - value_hbox = gtk_hbox_new (FALSE, 6); + value_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), pref_basic_update_alignment, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (pref_basic_update_hbox), value_hbox, FALSE, FALSE, 0); @@ -1106,13 +1082,9 @@ static void mateweather_pref_create(MateWeatherPref* pref) frame = create_hig_category (pref_basic_vbox, _("Display")); - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start (GTK_BOX (vbox), unit_grid, TRUE, TRUE, 0); -#else - gtk_box_pack_start (GTK_BOX (vbox), unit_table, TRUE, TRUE, 0); -#endif #ifdef RADARMAP gtk_box_pack_start (GTK_BOX (vbox), pref->priv->basic_radar_btn, TRUE, TRUE, 0); @@ -1134,7 +1106,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) /* * Location page. */ - pref_loc_hbox = gtk_vbox_new (FALSE, 6); + pref_loc_hbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width (GTK_CONTAINER (pref_loc_hbox), 12); gtk_container_add (GTK_CONTAINER (pref_notebook), pref_loc_hbox); @@ -1163,7 +1135,7 @@ static void mateweather_pref_create(MateWeatherPref* pref) gtk_box_pack_start (GTK_BOX (pref_loc_hbox), scrolled_window, TRUE, TRUE, 0); load_locations(pref); - pref_find_hbox = gtk_hbox_new (FALSE, 6); + pref_find_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); pref_find_label = gtk_label_new (_("_Find:")); gtk_label_set_use_underline (GTK_LABEL (pref_find_label), TRUE); diff --git a/multiload/global.h b/multiload/global.h index 8971df2c..f3ef24f3 100644 --- a/multiload/global.h +++ b/multiload/global.h @@ -30,18 +30,11 @@ struct _LoadGraph { guint allocated; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *colors; -#else - GdkColor *colors; -#endif gint **data; guint data_size; guint *pos; -#if !GTK_CHECK_VERSION (3, 0, 0) - gint colors_allocated; -#endif GtkWidget *main_widget; GtkWidget *frame, *box, *disp; cairo_surface_t *surface; diff --git a/multiload/load-graph.c b/multiload/load-graph.c index c0403e85..a98a81ab 100644 --- a/multiload/load-graph.c +++ b/multiload/load-graph.c @@ -15,10 +15,6 @@ #include "global.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - /* Shifts data right @@ -73,11 +69,7 @@ load_graph_draw (LoadGraph *g) for (j = 0; j < g->n; j++) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &(g->colors [j])); -#else - gdk_cairo_set_source_color (cr, &(g->colors [j])); -#endif for (i = 0; i < g->draw_width; i++) { if (g->data [i][j] != 0) { @@ -192,29 +184,14 @@ load_graph_configure (GtkWidget *widget, GdkEventConfigure *event, static gint load_graph_expose (GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#else - GdkEventExpose *event, -#endif gpointer data_ptr) { LoadGraph *g = (LoadGraph *) data_ptr; -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); -#endif - cairo_set_source_surface (cr, g->surface, 0, 0); cairo_paint (cr); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif - return FALSE; } @@ -264,39 +241,21 @@ load_graph_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data) static void load_graph_load_config (LoadGraph *g) { -#if GTK_CHECK_VERSION (3, 0, 0) gchar *name, *temp; -#else - gchar name [BUFSIZ], *temp; -#endif guint i; if (!g->colors) -#if GTK_CHECK_VERSION (3, 0, 0) g->colors = g_new0(GdkRGBA, g->n); -#else - g->colors = g_new0(GdkColor, g->n); -#endif for (i = 0; i < g->n; i++) { -#if GTK_CHECK_VERSION (3, 0, 0) name = g_strdup_printf ("%s-color%u", g->name, i); -#else - g_snprintf(name, sizeof(name), "%s-color%u", g->name, i); -#endif temp = g_settings_get_string(g->multiload->settings, name); if (!temp) temp = g_strdup ("#000000"); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse(&(g->colors[i]), temp); -#else - gdk_color_parse(temp, &(g->colors[i])); -#endif g_free(temp); -#if GTK_CHECK_VERSION (3, 0, 0) g_free(name); -#endif } } @@ -322,9 +281,9 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label, g->show_frame = TRUE; g->multiload = ma; - g->main_widget = gtk_vbox_new (FALSE, 0); + g->main_widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - g->box = gtk_vbox_new (FALSE, 0); + g->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); orient = mate_panel_applet_get_orient (g->multiload->applet); switch (orient) @@ -375,11 +334,7 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label, GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (G_OBJECT (g->disp), "draw", -#else - g_signal_connect (G_OBJECT (g->disp), "expose_event", -#endif G_CALLBACK (load_graph_expose), g); g_signal_connect (G_OBJECT(g->disp), "configure_event", G_CALLBACK (load_graph_configure), g); diff --git a/multiload/main.c b/multiload/main.c index 9915bed1..e26cd596 100644 --- a/multiload/main.c +++ b/multiload/main.c @@ -27,11 +27,6 @@ #include <mate-panel-applet.h> #include <mate-panel-applet-gsettings.h> -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - #include "global.h" static void @@ -101,9 +96,7 @@ start_procman (MultiloadApplet *ma) GDesktopAppInfo *appinfo; gchar *monitor; GdkAppLaunchContext *launch_context; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; -#endif GAppInfo *app_info; GdkScreen *screen; @@ -119,12 +112,8 @@ start_procman (MultiloadApplet *ma) GdkScreen *screen; GdkAppLaunchContext *context; screen = gtk_widget_get_screen (GTK_WIDGET (ma->applet)); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_screen_get_display (screen); context = gdk_display_get_app_launch_context (display); -#else - context = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (context, screen); g_app_info_launch (G_APP_INFO (appinfo), NULL, G_APP_LAUNCH_CONTEXT (context), &error); g_object_unref (context); @@ -137,12 +126,8 @@ start_procman (MultiloadApplet *ma) &error); if (!error) { -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_screen_get_display (screen); launch_context = gdk_display_get_app_launch_context (display); -#else - launch_context = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (launch_context, screen); g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error); @@ -440,10 +425,10 @@ multiload_applet_refresh(MultiloadApplet *ma) if ( (orientation == MATE_PANEL_APPLET_ORIENT_UP) || (orientation == MATE_PANEL_APPLET_ORIENT_DOWN) ) { - ma->box = gtk_hbox_new(FALSE, 0); + ma->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); } else - ma->box = gtk_vbox_new(FALSE, 0); + ma->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(ma->applet), ma->box); diff --git a/multiload/properties.c b/multiload/properties.c index b00635d8..47fb235e 100644 --- a/multiload/properties.c +++ b/multiload/properties.c @@ -33,11 +33,6 @@ #define HIG_IDENTATION " " #define NEVER_SENSITIVE "never_sensitive" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - /* set sensitive and setup NEVER_SENSITIVE appropriately */ static void hard_set_sensitive (GtkWidget *w, gboolean sensitivity) @@ -203,10 +198,8 @@ add_page(GtkWidget *notebook, gchar *label) GtkWidget *page; GtkWidget *page_label; - page = gtk_hbox_new(TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) + page = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous (GTK_BOX (page), TRUE); -#endif page_label = gtk_label_new(label); gtk_container_set_border_width(GTK_CONTAINER(page), 6); @@ -217,21 +210,11 @@ add_page(GtkWidget *notebook, gchar *label) /* save the selected color to gsettings and apply it on the applet */ static void -#if GTK_CHECK_VERSION (3, 0, 0) color_picker_set_cb(GtkColorChooser *color_picker, gchar *key) -#else -color_picker_set_cb(GtkColorButton *color_picker, gchar *key) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) gchar *color_string; guint8 prop_type; GdkRGBA color; -#else - gchar color_string[8]; - guint8 prop_type; - GdkColor color; -#endif MultiloadApplet *ma; ma = g_object_get_data (G_OBJECT (color_picker), "MultiloadApplet"); @@ -251,7 +234,6 @@ color_picker_set_cb(GtkColorButton *color_picker, gchar *key) else g_assert_not_reached(); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_get_rgba(color_picker, &color); color_string = gdk_rgba_to_string (&color); @@ -259,21 +241,7 @@ color_picker_set_cb(GtkColorButton *color_picker, gchar *key) gdk_rgba_parse(&(ma->graphs[prop_type]->colors[g_ascii_digit_value(key[strlen(key) - 1]) ]), color_string); -#else - gtk_color_button_get_color(color_picker, &color); - - snprintf(color_string, 8, "#%02X%02X%02X", - color.red / 256, color.green / 256, color.blue / 256); - g_settings_set_string(ma->settings, key, color_string); - gdk_color_parse(color_string, - &(ma->graphs[prop_type]->colors[g_ascii_digit_value(key[strlen(key) - 1]) ]) ); -#endif - -#if !GTK_CHECK_VERSION (3, 0, 0) - ma->graphs[prop_type]->colors_allocated = FALSE; -#endif - return; } @@ -284,29 +252,16 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma GtkWidget *vbox; GtkWidget *label; GtkWidget *color_picker; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - GdkColor color; -#endif gchar *color_string; color_string = g_settings_get_string (ma->settings, key); if (!color_string) color_string = g_strdup ("#000000"); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&color, color_string); -#else - color.red = (g_ascii_xdigit_value(color_string[1]) * 16 - + g_ascii_xdigit_value(color_string[2])) * 256; - color.green = (g_ascii_xdigit_value(color_string[3]) * 16 - + g_ascii_xdigit_value(color_string[4])) * 256; - color.blue = (g_ascii_xdigit_value(color_string[5]) * 16 - + g_ascii_xdigit_value(color_string[6])) * 256; -#endif g_free (color_string); - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); label = gtk_label_new_with_mnemonic(name); color_picker = gtk_color_button_new(); gtk_label_set_mnemonic_widget (GTK_LABEL (label), color_picker); @@ -318,11 +273,7 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma g_object_set_data (G_OBJECT (color_picker), "MultiloadApplet", ma); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(color_picker), &color); -#else - gtk_color_button_set_color(GTK_COLOR_BUTTON(color_picker), &color); -#endif g_signal_connect(G_OBJECT(color_picker), "color_set", G_CALLBACK(color_picker_set_cb), key); @@ -352,18 +303,18 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gchar *label_text; gchar *title; - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0); - categories_vbox = gtk_vbox_new (FALSE, 18); + categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_box_pack_start (GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0); gtk_widget_show (categories_vbox); - category_vbox = gtk_vbox_new (FALSE, 6); + category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0); gtk_widget_show (category_vbox); @@ -379,7 +330,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0); g_free (title); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -388,11 +339,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0); gtk_widget_show (indent); - control_vbox = gtk_vbox_new (FALSE, 6); + control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0); gtk_widget_show (control_vbox); - control_hbox = gtk_hbox_new (FALSE, 12); + control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0); gtk_widget_show (control_hbox); @@ -472,7 +423,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) G_CALLBACK (property_toggled_cb), "view-diskload"); gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0); - category_vbox = gtk_vbox_new (FALSE, 6); + category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0); gtk_widget_show (category_vbox); @@ -489,7 +440,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_widget_show (label); g_free (title); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -498,11 +449,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0); gtk_widget_show (indent); - control_vbox = gtk_vbox_new (FALSE, 6); + control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0); gtk_widget_show (control_vbox); - control_hbox = gtk_hbox_new (FALSE, 12); + control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0); gtk_widget_show (control_hbox); @@ -523,7 +474,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_size_group_add_widget (label_size, label); gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -555,7 +506,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) #endif gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - control_hbox = gtk_hbox_new (FALSE, 12); + control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0); gtk_widget_show (control_hbox); @@ -568,7 +519,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_size_group_add_widget (label_size, label); gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -600,7 +551,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) g_free(label_text); - category_vbox = gtk_vbox_new (FALSE, 6); + category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0); gtk_widget_show (category_vbox); @@ -617,7 +568,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_widget_show (label); g_free (title); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -626,7 +577,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma) gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0); gtk_widget_show (indent); - control_vbox = gtk_vbox_new (FALSE, 6); + control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0); gtk_widget_show (control_vbox); diff --git a/netspeed/src/netspeed.c b/netspeed/src/netspeed.c index 734d0785..b42fa018 100644 --- a/netspeed/src/netspeed.c +++ b/netspeed/src/netspeed.c @@ -33,11 +33,6 @@ #include "backend.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - /* Icons for the interfaces */ static const char* const dev_type_icon[DEV_UNKNOWN + 1] = { "mate-netspeed-loopback", /* DEV_LO */ @@ -96,12 +91,8 @@ typedef struct gboolean change_icon, auto_change_device; gboolean show_icon, short_unit; gboolean show_quality_icon; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA in_color; GdkRGBA out_color; -#else - GdkColor in_color, out_color; -#endif int width; GtkWidget *inbytes_text, *outbytes_text; @@ -189,27 +180,27 @@ applet_change_size_or_orient(MatePanelApplet *applet_widget, int arg1, MateNetsp } if (orient == MATE_PANEL_APPLET_ORIENT_LEFT || orient == MATE_PANEL_APPLET_ORIENT_RIGHT) { - applet->box = gtk_vbox_new(FALSE, 0); + applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); if (size > 64) { - applet->sum_box = gtk_hbox_new(FALSE, 2); - applet->in_box = gtk_hbox_new(FALSE, 1); - applet->out_box = gtk_hbox_new(FALSE, 1); + applet->sum_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); + applet->in_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1); + applet->out_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1); } else { - applet->sum_box = gtk_vbox_new(FALSE, 0); - applet->in_box = gtk_vbox_new(FALSE, 0); - applet->out_box = gtk_vbox_new(FALSE, 0); + applet->sum_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + applet->in_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + applet->out_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); } applet->labels_dont_shrink = FALSE; } else { - applet->in_box = gtk_hbox_new(FALSE, 1); - applet->out_box = gtk_hbox_new(FALSE, 1); + applet->in_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1); + applet->out_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1); if (size < 48) { - applet->sum_box = gtk_hbox_new(FALSE, 2); - applet->box = gtk_hbox_new(FALSE, 1); + applet->sum_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); + applet->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1); applet->labels_dont_shrink = TRUE; } else { - applet->sum_box = gtk_vbox_new(FALSE, 0); - applet->box = gtk_vbox_new(FALSE, 0); + applet->sum_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + applet->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); applet->labels_dont_shrink = !applet->show_sum; } } @@ -442,11 +433,7 @@ static void redraw_graph(MateNetspeedApplet *applet, cairo_t *cr) { GtkWidget *da = GTK_WIDGET(applet->drawingarea); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *stylecontext = gtk_widget_get_style_context (da); -#else - GtkStyle *style = gtk_widget_get_style (da); -#endif GdkWindow *real_window = gtk_widget_get_window (da); GdkRectangle ra; GtkStateType state; @@ -503,7 +490,6 @@ redraw_graph(MateNetspeedApplet *applet, cairo_t *cr) cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &applet->in_color); for (i = offset; i < GRAPH_VALUES; i++) { cairo_line_to (cr, in_points[i].x, in_points[i].y); @@ -511,15 +497,6 @@ redraw_graph(MateNetspeedApplet *applet, cairo_t *cr) cairo_stroke (cr); gdk_cairo_set_source_rgba (cr, &applet->out_color); -#else - gdk_cairo_set_source_color (cr, &applet->in_color); - for (i = offset; i < GRAPH_VALUES; i++) { - cairo_line_to (cr, in_points[i].x, in_points[i].y); - } - cairo_stroke (cr); - - gdk_cairo_set_source_color (cr, &applet->out_color); -#endif for (i = offset; i < GRAPH_VALUES; i++) { cairo_line_to (cr, out_points[i].x, out_points[i].y); } @@ -535,11 +512,7 @@ redraw_graph(MateNetspeedApplet *applet, cairo_t *cr) layout = gtk_widget_create_pango_layout (da, NULL); pango_layout_set_markup(layout, text, -1); g_free (text); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_render_layout(stylecontext, cr, 3, 2, layout); -#else - gtk_paint_layout(style, real_window, state, FALSE, &ra, da, "max_graph", 3, 2, layout); -#endif g_object_unref(G_OBJECT(layout)); text = bytes_to_string(0.0, TRUE, applet->show_bits, applet->short_unit); @@ -548,11 +521,7 @@ redraw_graph(MateNetspeedApplet *applet, cairo_t *cr) pango_layout_set_markup(layout, text, -1); pango_layout_get_pixel_extents (layout, NULL, &logical_rect); g_free (text); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_render_layout(stylecontext, cr, 3, h - 4 - logical_rect.height, layout); -#else - gtk_paint_layout(style, real_window, state, FALSE, &ra, da, "max_graph", 3, h - 4 - logical_rect.height, layout); -#endif g_object_unref(G_OBJECT(layout)); } @@ -998,13 +967,13 @@ settings_cb(GtkAction *action, gpointer data) gtk_dialog_set_default_response(GTK_DIALOG(applet->settings), GTK_RESPONSE_CLOSE); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); - categories_vbox = gtk_vbox_new(FALSE, 18); + categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_box_pack_start(GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0); - category_vbox = gtk_vbox_new(FALSE, 6); + category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start(GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0); header_str = g_strconcat("<span weight=\"bold\">", _("General Settings"), "</span>", NULL); @@ -1020,17 +989,17 @@ settings_cb(GtkAction *action, gpointer data) gtk_box_pack_start(GTK_BOX (category_vbox), category_header_label, FALSE, FALSE, 0); g_free(header_str); - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0); indent_label = gtk_label_new(" "); gtk_label_set_justify(GTK_LABEL (indent_label), GTK_JUSTIFY_LEFT); gtk_box_pack_start(GTK_BOX (hbox), indent_label, FALSE, FALSE, 0); - controls_vbox = gtk_vbox_new(FALSE, 10); + controls_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); gtk_box_pack_start(GTK_BOX(hbox), controls_vbox, TRUE, TRUE, 0); - network_device_hbox = gtk_hbox_new(FALSE, 6); + network_device_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start(GTK_BOX(controls_vbox), network_device_hbox, TRUE, TRUE, 0); network_device_label = gtk_label_new_with_mnemonic(_("Network _device:")); @@ -1116,29 +1085,15 @@ settings_cb(GtkAction *action, gpointer data) } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) da_draw(GtkWidget *widget, cairo_t *cr, gpointer data) -#else -da_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) -#endif { MateNetspeedApplet *applet = (MateNetspeedApplet*)data; -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); -#endif redraw_graph(applet, cr); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static void incolor_changed_cb (GtkColorChooser *button, gpointer data) { @@ -1153,24 +1108,7 @@ incolor_changed_cb (GtkColorChooser *button, gpointer data) g_settings_set_string (applet->gsettings, "in-color", string); g_free (string); } -#else -static void -incolor_changed_cb (GtkColorButton *cb, gpointer data) -{ - MateNetspeedApplet *applet = (MateNetspeedApplet*)data; - gchar *color; - GdkColor clr; - - gtk_color_button_get_color (cb, &clr); - applet->in_color = clr; - color = g_strdup_printf ("#%04x%04x%04x", clr.red, clr.green, clr.blue); - g_settings_set_string (applet->gsettings, "in-color", color); - g_free (color); -} -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static void outcolor_changed_cb (GtkColorChooser *button, gpointer data) { @@ -1185,22 +1123,6 @@ outcolor_changed_cb (GtkColorChooser *button, gpointer data) g_settings_set_string (applet->gsettings, "out-color", string); g_free (string); } -#else -static void -outcolor_changed_cb (GtkColorButton *cb, gpointer data) -{ - MateNetspeedApplet *applet = (MateNetspeedApplet*)data; - gchar *color; - GdkColor clr; - - gtk_color_button_get_color (cb, &clr); - applet->out_color = clr; - - color = g_strdup_printf ("#%04x%04x%04x", clr.red, clr.green, clr.blue); - g_settings_set_string (applet->gsettings, "out-color", color); - g_free (color); -} -#endif /* Handle info dialog response event */ @@ -1229,11 +1151,7 @@ showinfo_cb(GtkAction *action, gpointer data) { MateNetspeedApplet *applet = (MateNetspeedApplet*)data; GtkWidget *box, *hbox; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid, *da_frame; -#else - GtkWidget *table, *da_frame; -#endif GtkWidget *ip_label, *netmask_label; GtkWidget *hwaddr_label, *ptpip_label; GtkWidget *ip_text, *netmask_text; @@ -1262,18 +1180,12 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_dialog_set_default_response(GTK_DIALOG(applet->details), GTK_RESPONSE_CLOSE); - box = gtk_vbox_new(FALSE, 10); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); gtk_container_set_border_width(GTK_CONTAINER(box), 12); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID(grid), 10); gtk_grid_set_column_spacing (GTK_GRID(grid), 15); -#else - table = gtk_table_new(4, 4, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 10); - gtk_table_set_col_spacings(GTK_TABLE(table), 15); -#endif da_frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(da_frame), GTK_SHADOW_NONE); @@ -1281,20 +1193,15 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_widget_set_size_request(GTK_WIDGET(applet->drawingarea), -1, 180); gtk_container_add(GTK_CONTAINER(da_frame), GTK_WIDGET(applet->drawingarea)); - hbox = gtk_hbox_new(FALSE, 5); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); incolor_label = gtk_label_new_with_mnemonic(_("_In graph color")); outcolor_label = gtk_label_new_with_mnemonic(_("_Out graph color")); incolor_sel = gtk_color_button_new (); outcolor_sel = gtk_color_button_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (incolor_sel), &applet->in_color); gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (outcolor_sel), &applet->out_color); -#else - gtk_color_button_set_color (GTK_COLOR_BUTTON (incolor_sel), &applet->in_color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (outcolor_sel), &applet->out_color); -#endif gtk_label_set_mnemonic_widget(GTK_LABEL(incolor_label), incolor_sel); gtk_label_set_mnemonic_widget(GTK_LABEL(outcolor_label), outcolor_sel); @@ -1363,7 +1270,6 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_misc_set_alignment(GTK_MISC(applet->outbytes_text), 0.0f, 0.5f); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), ip_label, 0, 0, 1, 1); gtk_grid_attach(GTK_GRID(grid), ip_text, 1, 0, 1, 1); gtk_grid_attach(GTK_GRID(grid), netmask_label, 2, 0, 1, 1); @@ -1376,20 +1282,6 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_grid_attach(GTK_GRID(grid), applet->inbytes_text, 1, 2, 1, 1); gtk_grid_attach(GTK_GRID(grid), outbytes_label, 2, 2, 1, 1); gtk_grid_attach(GTK_GRID(grid), applet->outbytes_text, 3, 2, 1, 1); -#else - gtk_table_attach_defaults(GTK_TABLE(table), ip_label, 0, 1, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), ip_text, 1, 2, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), netmask_label, 2, 3, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), netmask_text, 3, 4, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), hwaddr_label, 0, 1, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), hwaddr_text, 1, 2, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), ptpip_label, 2, 3, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), ptpip_text, 3, 4, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), inbytes_label, 0, 1, 2, 3); - gtk_table_attach_defaults(GTK_TABLE(table), applet->inbytes_text, 1, 2, 2, 3); - gtk_table_attach_defaults(GTK_TABLE(table), outbytes_label, 2, 3, 2, 3); - gtk_table_attach_defaults(GTK_TABLE(table), applet->outbytes_text, 3, 4, 2, 3); -#endif /* check if we got an ipv6 address */ if (applet->devinfo.ipv6 && (strlen (applet->devinfo.ipv6) > 2)) { @@ -1409,15 +1301,8 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_misc_set_alignment (GTK_MISC (ipv6_label), 0.0f, 0.5f); gtk_misc_set_alignment (GTK_MISC (ipv6_text), 0.0f, 0.5f); #endif -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_grid_attach (GTK_GRID (grid), ipv6_label, 0, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), ipv6_text, 1, 3, 1, 1); -#else - - gtk_table_attach_defaults (GTK_TABLE (table), ipv6_label, 0, 1, 3, 4); - gtk_table_attach_defaults (GTK_TABLE (table), ipv6_text, 1, 2, 3, 4); -#endif } if (applet->devinfo.type == DEV_WIRELESS) { @@ -1456,31 +1341,17 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_misc_set_alignment (GTK_MISC (essid_label), 0.0f, 0.5f); gtk_misc_set_alignment (GTK_MISC (essid_text), 0.0f, 0.5f); #endif - gtk_label_set_selectable (GTK_LABEL (essid_text), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), signal_label, 2, 4, 1, 1); gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (applet->signalbar), 3, 4, 1, 1); gtk_grid_attach (GTK_GRID (grid), essid_label, 0, 4, 3, 1); gtk_grid_attach (GTK_GRID (grid), essid_text, 1, 4, 3, 1); -#else - gtk_table_attach_defaults (GTK_TABLE (table), signal_label, 2, 3, 4, 5); - gtk_table_attach_defaults (GTK_TABLE (table), GTK_WIDGET (applet->signalbar), 3, 4, 4, 5); - gtk_table_attach_defaults (GTK_TABLE (table), essid_label, 0, 3, 4, 5); - gtk_table_attach_defaults (GTK_TABLE (table), essid_text, 1, 4, 4, 5); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect(G_OBJECT(applet->drawingarea), "draw", G_CALLBACK(da_draw), (gpointer)applet); -#else - g_signal_connect(G_OBJECT(applet->drawingarea), "expose_event", - G_CALLBACK(da_expose_event), - (gpointer)applet); -#endif g_signal_connect(G_OBJECT(incolor_sel), "color_set", G_CALLBACK(incolor_changed_cb), @@ -1495,11 +1366,7 @@ showinfo_cb(GtkAction *action, gpointer data) gtk_box_pack_start(GTK_BOX(box), da_frame, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start(GTK_BOX(box), grid, FALSE, FALSE, 0); -#else - gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0); -#endif gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (applet->details)), box); gtk_widget_show_all(GTK_WIDGET(applet->details)); @@ -1788,21 +1655,13 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g tmp = g_settings_get_string (applet->gsettings, "in-color"); if (tmp) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&applet->in_color, tmp); -#else - gdk_color_parse (tmp, &applet->in_color); -#endif g_free(tmp); } tmp = g_settings_get_string (applet->gsettings, "out-color"); if (tmp) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&applet->out_color, tmp); -#else - gdk_color_parse(tmp, &applet->out_color); -#endif g_free(tmp); } @@ -1831,13 +1690,13 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g applet->dev_pix = gtk_image_new(); applet->qual_pix = gtk_image_new(); - applet->pix_box = gtk_hbox_new(FALSE, 0); + applet->pix_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); spacer = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(applet->pix_box), spacer, TRUE, TRUE, 0); spacer = gtk_label_new(""); gtk_box_pack_end(GTK_BOX(applet->pix_box), spacer, TRUE, TRUE, 0); - spacer_box = gtk_hbox_new(FALSE, 2); + spacer_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start(GTK_BOX(applet->pix_box), spacer_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(spacer_box), applet->qual_pix, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(spacer_box), applet->dev_pix, FALSE, FALSE, 0); diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c index 3ffc88dd..faed2de9 100644 --- a/stickynotes/stickynotes.c +++ b/stickynotes/stickynotes.c @@ -26,12 +26,7 @@ #include <libwnck/libwnck.h> #include <string.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtksourceview/gtksource.h> -#else -#include <gtksourceview/gtksourceview.h> -#include <gtksourceview/gtksourcebuffer.h> -#endif #include "stickynotes.h" #include "stickynotes_callbacks.h" @@ -343,15 +338,9 @@ void stickynote_change_properties (StickyNote *note) if (color_str) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; gdk_rgba_parse (&color, color_str); gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_color), &color); -#else - GdkColor color; - gdk_color_parse (color_str, &color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (note->w_color), &color); -#endif g_free (color_str); } @@ -364,15 +353,9 @@ void stickynote_change_properties (StickyNote *note) if (color_str) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA font_color; gdk_rgba_parse (&font_color, color_str); gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (note->w_font_color), &font_color); -#else - GdkColor font_color; - gdk_color_parse (color_str, &font_color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (note->w_font_color), &font_color); -#endif g_free (color_str); } @@ -486,129 +469,47 @@ stickynote_set_color (StickyNote *note, else font_color_str_actual = g_strdup (font_color_str); -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkRcStyle *rc_style = gtk_widget_get_modifier_style (note->w_window); -#endif - /* Do not use custom colors if "use_system_color" is enabled */ if (color_str_actual) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA colors[4]; -#else - GdkColor colors[6]; -#endif gint i; for (i = 0; i <= 3; i++) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&colors[i], color_str_actual); -#else - gdk_color_parse (color_str_actual, &colors[i]); -#endif colors[i].red = (colors[i].red * (10 - i)) / 10; colors[i].green = (colors[i].green * (10 - i)) / 10; colors[i].blue = (colors[i].blue * (10 - i)) / 10; } -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_color_parse ("black", &colors[4]); - gdk_color_parse ("white", &colors[5]); - - gboolean success[6]; - - /* Allocate these colors */ - gdk_colormap_alloc_colors (gtk_widget_get_colormap (note->w_window), - colors, 6, FALSE, TRUE, success); -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_background_color (note->w_window, GTK_STATE_NORMAL, &colors[0]); gtk_widget_override_background_color (note->w_body, GTK_STATE_NORMAL, &colors[0]); gtk_widget_override_background_color (note->w_lock, GTK_STATE_NORMAL, &colors[0]); gtk_widget_override_background_color (note->w_close, GTK_STATE_NORMAL, &colors[0]); gtk_widget_override_background_color (note->w_resize_se, GTK_STATE_NORMAL, &colors[0]); gtk_widget_override_background_color (note->w_resize_sw, GTK_STATE_NORMAL, &colors[0]); -#else - /* Apply colors to style */ - rc_style->base[GTK_STATE_NORMAL] = colors[0]; - rc_style->bg[GTK_STATE_PRELIGHT] = colors[1]; - rc_style->bg[GTK_STATE_NORMAL] = colors[2]; - rc_style->bg[GTK_STATE_ACTIVE] = colors[3]; - - rc_style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_BG; - rc_style->color_flags[GTK_STATE_NORMAL] = - GTK_RC_BG | GTK_RC_BASE; - rc_style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_BG; -#endif } else { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_background_color (note->w_window, GTK_STATE_NORMAL, NULL); gtk_widget_override_background_color (note->w_body, GTK_STATE_NORMAL, NULL); gtk_widget_override_background_color (note->w_lock, GTK_STATE_NORMAL, NULL); gtk_widget_override_background_color (note->w_close, GTK_STATE_NORMAL, NULL); gtk_widget_override_background_color (note->w_resize_se, GTK_STATE_NORMAL, NULL); gtk_widget_override_background_color (note->w_resize_sw, GTK_STATE_NORMAL, NULL); -#else - rc_style->color_flags[GTK_STATE_PRELIGHT] = 0; - rc_style->color_flags[GTK_STATE_NORMAL] = 0; - rc_style->color_flags[GTK_STATE_ACTIVE] = 0; -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) - g_object_ref (G_OBJECT (rc_style)); - - /* Apply the style to the widgets */ - gtk_widget_modify_style (note->w_window, rc_style); - gtk_widget_modify_style (note->w_body, rc_style); - gtk_widget_modify_style (note->w_lock, rc_style); - gtk_widget_modify_style (note->w_close, rc_style); - gtk_widget_modify_style (note->w_resize_se, rc_style); - gtk_widget_modify_style (note->w_resize_sw, rc_style); - - g_object_unref (G_OBJECT (rc_style)); -#endif - if (font_color_str_actual) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; gdk_rgba_parse (&color, font_color_str_actual); gtk_widget_override_color (note->w_window, GTK_STATE_NORMAL, &color); gtk_widget_override_color (note->w_body, GTK_STATE_NORMAL, &color); -#else - GdkColor font_color; - - gdk_color_parse (font_color_str_actual, &font_color); - - gtk_widget_modify_text (note->w_window, - GTK_STATE_NORMAL, &font_color); - gtk_widget_modify_text (note->w_window, - GTK_STATE_PRELIGHT, &font_color); - gtk_widget_modify_text (note->w_body, - GTK_STATE_NORMAL, &font_color); - gtk_widget_modify_text (note->w_body, - GTK_STATE_PRELIGHT, &font_color); -#endif } else { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_color (note->w_window, GTK_STATE_NORMAL, NULL); gtk_widget_override_color (note->w_body, GTK_STATE_NORMAL, NULL); -#else - gtk_widget_modify_text (note->w_window, - GTK_STATE_NORMAL, NULL); - gtk_widget_modify_text (note->w_window, - GTK_STATE_PRELIGHT, NULL); - gtk_widget_modify_text (note->w_body, - GTK_STATE_NORMAL, NULL); - gtk_widget_modify_text (note->w_body, - GTK_STATE_PRELIGHT, NULL); -#endif } if (color_str_actual) @@ -621,11 +522,7 @@ stickynote_set_color (StickyNote *note, void stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save) { -#if GTK_CHECK_VERSION (3, 0, 0) PangoFontDescription *font_desc; -#else - GtkRcStyle *rc_style = gtk_widget_get_modifier_style(note->w_window); -#endif gchar *font_str_actual; if (save) { @@ -649,30 +546,15 @@ stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save) font_str_actual = g_strdup (font_str); /* Do not use custom fonts if "use_system_font" is enabled */ -#if GTK_CHECK_VERSION (3, 0, 0) font_desc = font_str_actual ? -#else - pango_font_description_free (rc_style->font_desc); - rc_style->font_desc = font_str_actual ? -#endif pango_font_description_from_string (font_str_actual): NULL; /* Apply the style to the widgets */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_font (note->w_window, font_desc); gtk_widget_override_font (note->w_body, font_desc); -#else - g_object_ref (G_OBJECT (rc_style)); - gtk_widget_modify_style(note->w_window, rc_style); - gtk_widget_modify_style(note->w_body, rc_style); -#endif g_free (font_str_actual); -#if GTK_CHECK_VERSION (3, 0, 0) pango_font_description_free (font_desc); -#else - g_object_unref (G_OBJECT(rc_style)); -#endif } /* Lock/Unlock a sticky note from editing */ diff --git a/stickynotes/stickynotes.h b/stickynotes/stickynotes.h index 929c5ad0..e5a969b4 100644 --- a/stickynotes/stickynotes.h +++ b/stickynotes/stickynotes.h @@ -24,12 +24,7 @@ #include <libwnck/libwnck.h> #include <stickynotes_applet.h> -#if GTK_CHECK_VERSION (3, 0, 0) #include <gtksourceview/gtksource.h> -#else -#include <gtksourceview/gtksourceview.h> -#include <gtksourceview/gtksourcebuffer.h> -#endif typedef struct { diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c index 6448b896..6f39b78b 100644 --- a/stickynotes/stickynotes_applet.c +++ b/stickynotes/stickynotes_applet.c @@ -444,11 +444,7 @@ stickynotes_applet_update_prefs (void) gboolean sys_color, sys_font, sticky, force_default, desktop_hide; char *font_str; char *color_str, *font_color_str; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color, font_color; -#else - GdkColor color, font_color; -#endif width = g_settings_get_int (stickynotes->settings, "default-width"); width = MAX (width, 1); @@ -478,13 +474,8 @@ stickynotes_applet_update_prefs (void) font_color_str = g_strdup ("#000000"); } -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&color, color_str); gdk_rgba_parse (&font_color, font_color_str); -#else - gdk_color_parse (color_str, &color); - gdk_color_parse (font_color_str, &font_color); -#endif g_free (color_str); g_free (font_color_str); @@ -507,13 +498,8 @@ stickynotes_applet_update_prefs (void) GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop), desktop_hide); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color), &color); gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_font_color), &font_color); -#else - gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); - gtk_color_button_set_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); -#endif gtk_font_button_set_font_name (GTK_FONT_BUTTON (stickynotes->w_prefs_font), font_str); g_free (font_str); @@ -622,11 +608,7 @@ stickynotes_applet_panel_icon_get_geometry (int *x, int *y, int *width, int *hei widget = GTK_WIDGET (applet->w_image); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (widget, NULL, &requisition); -#else - gtk_widget_size_request (widget, &requisition); -#endif gdk_window_get_origin (gtk_widget_get_window (widget), x, y); diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c index 8c95ed2a..1bee855f 100644 --- a/stickynotes/stickynotes_applet_callbacks.c +++ b/stickynotes/stickynotes_applet_callbacks.c @@ -423,7 +423,6 @@ preferences_color_cb (GtkWidget *button, gpointer data) { char *color_str, *font_color_str; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color, font_color; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (stickynotes->w_prefs_color), &color); @@ -431,21 +430,6 @@ preferences_color_cb (GtkWidget *button, gpointer data) color_str = gdk_rgba_to_string (&color); font_color_str = gdk_rgba_to_string (&font_color); -#else - GdkColor color, font_color; - - gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color); - gtk_color_button_get_color (GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color), &font_color); - - color_str = g_strdup_printf ("#%.2x%.2x%.2x", - color.red / 256, - color.green / 256, - color.blue / 256); - font_color_str = g_strdup_printf ("#%.2x%.2x%.2x", - font_color.red / 256, - font_color.green / 256, - font_color.blue / 256); -#endif g_settings_set_string (stickynotes->settings, "default-color", color_str); g_settings_set_string (stickynotes->settings, "default-font-color", font_color_str); diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c index d1e23dde..bd6a4577 100644 --- a/stickynotes/stickynotes_callbacks.c +++ b/stickynotes/stickynotes_callbacks.c @@ -143,7 +143,6 @@ void properties_apply_color_cb(StickyNote *note) if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(note->w_def_color))) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color, font_color; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (note->w_color), &color); @@ -151,21 +150,6 @@ void properties_apply_color_cb(StickyNote *note) color_str = gdk_rgba_to_string (&color); font_color_str = gdk_rgba_to_string (&font_color); -#else - GdkColor color, font_color; - - gtk_color_button_get_color (GTK_COLOR_BUTTON (note->w_color), &color); - gtk_color_button_get_color (GTK_COLOR_BUTTON (note->w_font_color), &font_color); - - color_str = g_strdup_printf ("#%.2x%.2x%.2x", - color.red / 256, - color.green / 256, - color.blue / 256); - font_color_str = g_strdup_printf ("#%.2x%.2x%.2x", - font_color.red / 256, - font_color.green / 256, - font_color.blue / 256); -#endif } stickynote_set_color (note, color_str, font_color_str, TRUE); diff --git a/timerapplet/timerapplet.c b/timerapplet/timerapplet.c index 86e0dbda..ebcb5e36 100644 --- a/timerapplet/timerapplet.c +++ b/timerapplet/timerapplet.c @@ -45,10 +45,6 @@ #define SHOW_NOTIFICATION_KEY "show-notification" #define SHOW_DIALOG_KEY "show-dialog" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - typedef struct { MatePanelApplet *applet; @@ -284,11 +280,7 @@ static void timer_preferences_callback (GtkAction *action, TimerApplet *applet) { GtkDialog *dialog; -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid; -#else - GtkTable *table; -#endif GtkWidget *widget; gint duration, hours, minutes, seconds; @@ -303,15 +295,9 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL)); -#if GTK_CHECK_VERSION (3, 0, 0) grid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_row_spacing (grid, 12); gtk_grid_set_column_spacing (grid, 12); -#else - table = GTK_TABLE (gtk_table_new (6, 2, FALSE)); - gtk_table_set_row_spacings (table, 12); - gtk_table_set_col_spacings (table, 12); -#endif gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 150); gtk_container_set_border_width (GTK_CONTAINER (dialog), 10); @@ -323,21 +309,10 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 0, 1, 1); widget = gtk_entry_new (); gtk_grid_attach (grid, widget, 2, 0, 1, 1); -#else - gtk_table_attach (table, widget, 1, 2, 0, 1, - GTK_FILL, GTK_FILL, - 0, 0); - - widget = gtk_entry_new (); - gtk_table_attach (table, widget, 2, 3, 0, 1, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif g_settings_bind (applet->settings, NAME_KEY, widget, "text", G_SETTINGS_BIND_DEFAULT); widget = gtk_label_new (_("Hours:")); @@ -347,23 +322,11 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 1, 1, 1); widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), hours); gtk_grid_attach (grid, widget, 2, 1, 1, 1); -#else - gtk_table_attach (table, widget, 1, 2, 1, 2, - GTK_FILL, GTK_FILL, - 0, 0); - - widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), hours); - gtk_table_attach (table, widget, 2, 3, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif applet->hours = GTK_SPIN_BUTTON (widget); g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet); @@ -374,23 +337,11 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 2, 1, 1); widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), minutes); gtk_grid_attach (grid, widget, 2, 2, 1, 1);; -#else - gtk_table_attach (table, widget, 1, 2, 2, 3, - GTK_FILL, GTK_FILL, - 0, 0); - - widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), minutes); - gtk_table_attach (table, widget, 2, 3, 2, 3, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif applet->minutes = GTK_SPIN_BUTTON (widget); g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet); @@ -401,28 +352,15 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) #else gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 1, 3, 1, 1); widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), seconds); gtk_grid_attach (grid, widget, 2, 3, 1, 1); -#else - gtk_table_attach (table, widget, 1, 2, 3, 4, - GTK_FILL, GTK_FILL, - 0, 0); - - widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), seconds); - gtk_table_attach (table, widget, 2, 3, 3, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); -#endif applet->seconds = GTK_SPIN_BUTTON (widget); g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet); widget = gtk_check_button_new_with_label (_("Show notification popup")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, widget, 2, 4, 1, 1); g_settings_bind (applet->settings, SHOW_NOTIFICATION_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT); @@ -431,20 +369,6 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) g_settings_bind (applet->settings, SHOW_DIALOG_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (grid), TRUE, TRUE, 0); -#else - gtk_table_attach (table, widget, 2, 3, 4, 5, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); - g_settings_bind (applet->settings, SHOW_NOTIFICATION_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT); - - widget = gtk_check_button_new_with_label (_("Show dialog")); - gtk_table_attach (table, widget, 2, 3, 5, 6, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, - 0, 0); - g_settings_bind (applet->settings, SHOW_DIALOG_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT); - - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (table), TRUE, TRUE, 0); -#endif g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); @@ -478,7 +402,7 @@ timer_applet_fill (MatePanelApplet* applet_widget) applet->active = FALSE; applet->pause = FALSE; - applet->box = GTK_BOX (gtk_hbox_new (FALSE, 0)); + applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, GTK_ICON_SIZE_BUTTON)); applet->pause_image = GTK_IMAGE (gtk_image_new_from_icon_name (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON)); applet->label = GTK_LABEL (gtk_label_new ("")); diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c index e406dfb2..3d56d013 100644 --- a/trashapplet/src/trashapplet.c +++ b/trashapplet/src/trashapplet.c @@ -36,11 +36,6 @@ #include "trash-empty.h" #include "xstuff.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - typedef MatePanelAppletClass TrashAppletClass; typedef struct @@ -469,7 +464,7 @@ confirm_delete_immediately (GtkWidget *parent_view, gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, @@ -477,16 +472,12 @@ confirm_delete_immediately (GtkWidget *parent_view, image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_START); -#else - gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); -#endif gtk_widget_show (image); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); - vbox = gtk_vbox_new (FALSE, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); diff --git a/trashapplet/src/xstuff.c b/trashapplet/src/xstuff.c index c8b181c5..ccd26cc4 100644 --- a/trashapplet/src/xstuff.c +++ b/trashapplet/src/xstuff.c @@ -177,14 +177,6 @@ xstuff_is_compliant_wm (void) return TRUE; } -#if !GTK_CHECK_VERSION (3, 0, 0) -gboolean -xstuff_net_wm_supports (const char *hint) -{ - return gdk_net_wm_supports (gdk_atom_intern (hint, FALSE)); -} -#endif - void xstuff_set_no_group (GdkWindow *win) { @@ -250,12 +242,7 @@ xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h) gdk_window_move_resize (window, x, y, w, h); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_flush (); - gdk_error_trap_pop (); -#endif g_object_set_data (G_OBJECT (window), "xstuff-cached-x", GINT_TO_POINTER (x)); g_object_set_data (G_OBJECT (window), "xstuff-cached-y", GINT_TO_POINTER (y)); @@ -343,17 +330,9 @@ draw_zoom_animation (GdkScreen *gscreen, dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen)); root_win = GDK_WINDOW_XID (gdk_screen_get_root_window (gscreen)); screen = gdk_screen_get_number (gscreen); -#if GTK_CHECK_VERSION (3, 0, 0) depth = DefaultDepth(dpy,screen); -#else - depth = gdk_drawable_get_depth (gdk_screen_get_root_window (gscreen)); -#endif /* frame GC */ -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_colormap_alloc_color ( - gdk_screen_get_system_colormap (gscreen), &color, FALSE, TRUE); -#endif gcv.function = GXxor; /* this will raise the probability of the XORed color being different * of the original color in PseudoColor when not all color cells are @@ -444,10 +423,6 @@ draw_zoom_animation (GdkScreen *gscreen, XUngrabServer(dpy); XFreeGC (dpy, frame_gc); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_colormap_free_colors (gdk_screen_get_system_colormap (gscreen), - &color, 1); -#endif } #undef FRAMES @@ -529,11 +504,7 @@ xstuff_grab_key_on_all_screens (int keycode, int i; display = gdk_display_get_default (); -#if GTK_CHECK_VERSION(3, 0, 0) n_screens = 1; /* gdk-3.10, The number of screens is always 1 */ -#else - n_screens = gdk_display_get_n_screens (display); -#endif for (i = 0; i < n_screens; i++) { GdkWindow *root; diff --git a/trashapplet/src/xstuff.h b/trashapplet/src/xstuff.h index 6bc1e835..5791cafa 100644 --- a/trashapplet/src/xstuff.h +++ b/trashapplet/src/xstuff.h @@ -7,9 +7,6 @@ void xstuff_delete_property (GdkWindow *window, const char *name); gboolean xstuff_is_compliant_wm (void); -#if !GTK_CHECK_VERSION (3, 0, 0) -gboolean xstuff_net_wm_supports (const char *hint); -#endif void xstuff_set_no_group (GdkWindow *win); |