From 51291bf1b29004ea4703845fc127cc1a4468b092 Mon Sep 17 00:00:00 2001 From: infirit Date: Mon, 19 May 2014 14:52:18 +0200 Subject: [PATCH] Replace deprecated gtk widget function The replacement functions are available since 2.18 GTK_WIDGET_HAS_FOCUS -> gtk_widget_has_focus GTK_WIDGET_VISIBLE -> gtk_widget_get_visible GTK_WIDGET_SET_FLAGS -> gtk_widget_set_* --- .../checkupdate/pluma-check-update-plugin.c | 4 +- .../filebrowser/pluma-file-browser-utils.c | 8 ---- plugins/filebrowser/pluma-file-browser-view.c | 4 -- plugins/spell/pluma-spell-checker-dialog.c | 4 -- pluma/pluma-io-error-message-area.c | 40 ------------------- pluma/pluma-message-area.c | 4 +- pluma/pluma-panel.c | 4 -- pluma/pluma-print-preview.c | 4 -- pluma/pluma-session.c | 8 +--- pluma/pluma-spinner.c | 2 +- pluma/pluma-utils.c | 4 -- pluma/pluma-view.c | 10 +---- pluma/pluma-window.c | 24 +++++------ 13 files changed, 18 insertions(+), 102 deletions(-) diff --git a/plugins/checkupdate/pluma-check-update-plugin.c b/plugins/checkupdate/pluma-check-update-plugin.c index b28991a..42cd2b4 100644 --- a/plugins/checkupdate/pluma-check-update-plugin.c +++ b/plugins/checkupdate/pluma-check-update-plugin.c @@ -186,7 +186,7 @@ set_message_area_text_and_icon (GtkWidget *message_area, gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (primary_label, TRUE); gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); if (secondary_text != NULL) @@ -197,7 +197,7 @@ set_message_area_text_and_icon (GtkWidget *message_area, g_free (secondary_markup); gtk_widget_show (secondary_label); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (secondary_label, TRUE); gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); diff --git a/plugins/filebrowser/pluma-file-browser-utils.c b/plugins/filebrowser/pluma-file-browser-utils.c index 86c6405..8c1b6a3 100644 --- a/plugins/filebrowser/pluma-file-browser-utils.c +++ b/plugins/filebrowser/pluma-file-browser-utils.c @@ -170,11 +170,7 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_widget_show (button); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_default (button, TRUE); -#else - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); -#endif gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_CANCEL); @@ -188,11 +184,7 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, } gtk_widget_show (button); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_default (button, TRUE); -#else - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); -#endif gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_OK); diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c index 6092248..bf8a11a 100644 --- a/plugins/filebrowser/pluma-file-browser-view.c +++ b/plugins/filebrowser/pluma-file-browser-view.c @@ -642,11 +642,7 @@ key_press_event (GtkWidget *widget, handled = FALSE; break; } -#if GTK_CHECK_VERSION (3, 0, 0) if (!gtk_widget_has_focus (widget)) { -#else - if (!GTK_WIDGET_HAS_FOCUS (widget)) { -#endif handled = FALSE; break; } diff --git a/plugins/spell/pluma-spell-checker-dialog.c b/plugins/spell/pluma-spell-checker-dialog.c index b41feaf..a0d0b06 100755 --- a/plugins/spell/pluma-spell-checker-dialog.c +++ b/plugins/spell/pluma-spell-checker-dialog.c @@ -291,11 +291,7 @@ create_dialog (PlumaSpellCheckerDialog *dlg, gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); /* Set default button */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_default (dlg->change_button, TRUE); -#else - GTK_WIDGET_SET_FLAGS (dlg->change_button, GTK_CAN_DEFAULT); -#endif gtk_widget_grab_default (dlg->change_button); gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE); diff --git a/pluma/pluma-io-error-message-area.c b/pluma/pluma-io-error-message-area.c index 38e19cc..14ed976 100644 --- a/pluma/pluma-io-error-message-area.c +++ b/pluma/pluma-io-error-message-area.c @@ -144,11 +144,7 @@ set_message_area_text_and_icon (GtkWidget *message_area, gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (primary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); if (secondary_text != NULL) @@ -158,11 +154,7 @@ set_message_area_text_and_icon (GtkWidget *message_area, secondary_label = gtk_label_new (secondary_markup); g_free (secondary_markup); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (secondary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); @@ -578,11 +570,7 @@ create_conversion_error_message_area (const gchar *primary_text, gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (primary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); if (secondary_text != NULL) @@ -592,11 +580,7 @@ create_conversion_error_message_area (const gchar *primary_text, secondary_label = gtk_label_new (secondary_markup); g_free (secondary_markup); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (secondary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); @@ -869,11 +853,7 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (primary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); secondary_text = _("pluma opened this instance of the file in a non-editable way. " @@ -883,11 +863,7 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) secondary_label = gtk_label_new (secondary_markup); g_free (secondary_markup); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (secondary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); @@ -983,11 +959,7 @@ pluma_externally_modified_saving_error_message_area_new ( gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (primary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); secondary_text = _("If you save it, all the external changes could be lost. Save it anyway?"); @@ -996,11 +968,7 @@ pluma_externally_modified_saving_error_message_area_new ( secondary_label = gtk_label_new (secondary_markup); g_free (secondary_markup); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (secondary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); @@ -1101,11 +1069,7 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE); gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (primary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE); secondary_text = _("pluma could not back up the old copy of the file before saving the new one. " @@ -1116,11 +1080,7 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, secondary_label = gtk_label_new (secondary_markup); g_free (secondary_markup); gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (secondary_label, TRUE); -#else - GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS); -#endif gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE); gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE); diff --git a/pluma/pluma-message-area.c b/pluma/pluma-message-area.c index e13667a..9aad106 100644 --- a/pluma/pluma-message-area.c +++ b/pluma/pluma-message-area.c @@ -382,7 +382,7 @@ pluma_message_area_add_button (PlumaMessageArea *message_area, button = gtk_button_new_from_stock (button_text); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_widget_show (button); @@ -613,7 +613,7 @@ pluma_message_area_add_stock_button_with_text (PlumaMessageArea *message_area, gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON)); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (button, TRUE); gtk_widget_show (button); diff --git a/pluma/pluma-panel.c b/pluma/pluma-panel.c index 3bc47df..5271eeb 100644 --- a/pluma/pluma-panel.c +++ b/pluma/pluma-panel.c @@ -706,11 +706,7 @@ pluma_panel_add_item (PlumaPanel *panel, menu_label = gtk_label_new (name); gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) if (!gtk_widget_get_visible (item)) -#else - if (!GTK_WIDGET_VISIBLE (item)) -#endif gtk_widget_show (item); gtk_notebook_append_page_menu (GTK_NOTEBOOK (panel->priv->notebook), diff --git a/pluma/pluma-print-preview.c b/pluma/pluma-print-preview.c index 350f736..ac7bbdd 100644 --- a/pluma/pluma-print-preview.c +++ b/pluma/pluma-print-preview.c @@ -959,11 +959,7 @@ create_preview_layout (PlumaPrintPreview *preview) GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_focus (priv->layout, TRUE); -#else - GTK_WIDGET_SET_FLAGS (priv->layout, GTK_CAN_FOCUS); -#endif g_signal_connect (priv->layout, "key-press-event", diff --git a/pluma/pluma-session.c b/pluma/pluma-session.c index 2cc4ec3..8971ce0 100644 --- a/pluma/pluma-session.c +++ b/pluma/pluma-session.c @@ -54,10 +54,6 @@ #include "dialogs/pluma-close-confirmation-dialog.h" #include "smclient/eggsmclient.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#endif - /* The master client we use for SM */ static EggSMClient *master_client = NULL; @@ -91,11 +87,11 @@ save_window_session (GKeyFile *state_file, panel = pluma_window_get_side_panel (window); g_key_file_set_boolean (state_file, group_name, "side-panel-visible", - GTK_WIDGET_VISIBLE (panel)); + gtk_widget_get_visible (panel)); panel = pluma_window_get_bottom_panel (window); g_key_file_set_boolean (state_file, group_name, "bottom-panel-visible", - GTK_WIDGET_VISIBLE (panel)); + gtk_widget_get_visible (panel)); active_document = pluma_window_get_active_document (window); if (active_document) diff --git a/pluma/pluma-spinner.c b/pluma/pluma-spinner.c index 4ce5928..eea394f 100644 --- a/pluma/pluma-spinner.c +++ b/pluma/pluma-spinner.c @@ -616,7 +616,7 @@ pluma_spinner_init (PlumaSpinner *spinner) priv = spinner->priv = PLUMA_SPINNER_GET_PRIVATE (spinner); - GTK_WIDGET_SET_FLAGS (GTK_WIDGET (spinner), GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE); priv->cache = pluma_spinner_cache_ref (); priv->size = GTK_ICON_SIZE_DIALOG; diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index e631eca..f6a9dbb 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -241,11 +241,7 @@ pluma_dialog_add_button (GtkDialog *dialog, button = pluma_gtk_button_new_with_stock_icon (text, stock_id); g_return_val_if_fail (button != NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_default (button, TRUE); -#else - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); -#endif gtk_widget_show (button); diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index d4fe14e..dd5a1dd 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -53,10 +53,6 @@ #include "pluma-marshal.h" #include "pluma-utils.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#endif - #define PLUMA_VIEW_SCROLL_MARGIN 0.02 #define PLUMA_VIEW_SEARCH_DIALOG_TIMEOUT (30*1000) /* 30 seconds */ @@ -1801,14 +1797,10 @@ start_interactive_search_real (PlumaView *view) GtkTextBuffer *buffer; if ((view->priv->search_window != NULL) && - GTK_WIDGET_VISIBLE (view->priv->search_window)) + gtk_widget_get_visible (view->priv->search_window)) return TRUE; -#if GTK_CHECK_VERSION (3, 0, 0) if (!gtk_widget_has_focus (view)) -#else - if (!GTK_WIDGET_HAS_FOCUS (view)) -#endif return FALSE; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index 5fa926b..95483aa 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -65,10 +65,6 @@ #include "osx/pluma-osx.h" #endif -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#endif - #define LANGUAGE_NONE (const gchar *)"LangNone" #define PLUMA_UIFILE "pluma-ui.xml" #define TAB_WIDTH_DATA "PlumaWindowTabWidthData" @@ -581,7 +577,7 @@ set_toolbar_style (PlumaWindow *window, if (origin == NULL) visible = pluma_prefs_manager_get_toolbar_visible (); else - visible = GTK_WIDGET_VISIBLE (origin->priv->toolbar); + visible = gtk_widget_get_visible (origin->priv->toolbar); /* Set visibility */ if (visible) @@ -1406,7 +1402,7 @@ toolbar_visibility_changed (GtkWidget *toolbar, gboolean visible; GtkAction *action; - visible = GTK_WIDGET_VISIBLE (toolbar); + visible = gtk_widget_get_visible (toolbar); if (pluma_prefs_manager_toolbar_visible_can_set ()) pluma_prefs_manager_set_toolbar_visible (visible); @@ -1826,7 +1822,7 @@ set_statusbar_style (PlumaWindow *window, if (origin == NULL) visible = pluma_prefs_manager_get_statusbar_visible (); else - visible = GTK_WIDGET_VISIBLE (origin->priv->statusbar); + visible = gtk_widget_get_visible (origin->priv->statusbar); if (visible) gtk_widget_show (window->priv->statusbar); @@ -1849,7 +1845,7 @@ statusbar_visibility_changed (GtkWidget *statusbar, gboolean visible; GtkAction *action; - visible = GTK_WIDGET_VISIBLE (statusbar); + visible = gtk_widget_get_visible (statusbar); if (pluma_prefs_manager_statusbar_visible_can_set ()) pluma_prefs_manager_set_statusbar_visible (visible); @@ -2122,12 +2118,12 @@ clone_window (PlumaWindow *origin) _pluma_panel_set_active_item_by_id (PLUMA_PANEL (window->priv->bottom_panel), panel_page); - if (GTK_WIDGET_VISIBLE (origin->priv->side_panel)) + if (gtk_widget_get_visible (origin->priv->side_panel)) gtk_widget_show (window->priv->side_panel); else gtk_widget_hide (window->priv->side_panel); - if (GTK_WIDGET_VISIBLE (origin->priv->bottom_panel)) + if (gtk_widget_get_visible (origin->priv->bottom_panel)) gtk_widget_show (window->priv->bottom_panel); else gtk_widget_hide (window->priv->bottom_panel); @@ -3647,7 +3643,7 @@ side_panel_visibility_changed (GtkWidget *side_panel, gboolean visible; GtkAction *action; - visible = GTK_WIDGET_VISIBLE (side_panel); + visible = gtk_widget_get_visible (side_panel); if (pluma_prefs_manager_side_pane_visible_can_set ()) pluma_prefs_manager_set_side_pane_visible (visible); @@ -3701,7 +3697,7 @@ bottom_panel_visibility_changed (PlumaPanel *bottom_panel, gboolean visible; GtkAction *action; - visible = GTK_WIDGET_VISIBLE (GTK_WIDGET (bottom_panel)); + visible = gtk_widget_get_visible (GTK_WIDGET (bottom_panel)); if (pluma_prefs_manager_bottom_panel_visible_can_set ()) pluma_prefs_manager_set_bottom_panel_visible (visible); @@ -4173,7 +4169,7 @@ pluma_window_create_tab (PlumaWindow *window, -1, jump_to); - if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) + if (!gtk_widget_get_visible (GTK_WIDGET (window))) { gtk_window_present (GTK_WINDOW (window)); } @@ -4225,7 +4221,7 @@ pluma_window_create_tab_from_uri (PlumaWindow *window, jump_to); - if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) + if (!gtk_widget_get_visible (GTK_WIDGET (window))) { gtk_window_present (GTK_WINDOW (window)); }