From 12b4859dc7377a979ddfed8ed27f23c31e1ada64 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 2 Apr 2010 18:38:56 +0200 Subject: [PATCH] Use gtk_widget_get_visible rather than GTK_WIDGET_VISIBLE --- midori/midori-browser.c | 52 +++++++++++++++++----------------- midori/midori-locationaction.c | 12 ++++---- midori/midori-panel.c | 6 ++-- midori/midori-searchaction.c | 2 +- midori/sokoke.h | 1 + 5 files changed, 37 insertions(+), 36 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 371d8389..a72916c3 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -339,10 +339,10 @@ _midori_browser_update_interface (MidoriBrowser* browser) g_object_set (action, "stock-id", GTK_STOCK_STOP, "tooltip", _("Stop loading the current page"), NULL); - if (!browser->progress_in_location || !GTK_WIDGET_VISIBLE (browser->navigationbar)) + if (!browser->progress_in_location || !gtk_widget_get_visible (browser->navigationbar)) gtk_widget_show (browser->progressbar); - if (!GTK_WIDGET_VISIBLE (browser->statusbar) && - !GTK_WIDGET_VISIBLE (browser->navigationbar) && + if (!gtk_widget_get_visible (browser->statusbar) && + !gtk_widget_get_visible (browser->navigationbar) && browser->progress_in_location) gtk_widget_show (browser->navigationbar); if (browser->progress_in_location) @@ -387,7 +387,7 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser, katze_assign (browser->statusbar_text, sokoke_format_uri_for_display (text)); - if (!GTK_WIDGET_VISIBLE (browser->statusbar) && !is_location) + if (!gtk_widget_get_visible (browser->statusbar) && !is_location) { GtkAction* action = _action_by_name (browser, "Location"); MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action); @@ -704,7 +704,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, GtkWidget* check_toolbar; GtkWidget* check_app; - if (!browser->bookmarks || !GTK_WIDGET_VISIBLE (browser)) + if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser))) return; if (is_folder) @@ -888,7 +888,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar))) - if (!GTK_WIDGET_VISIBLE (browser->bookmarkbar)) + if (!gtk_widget_get_visible (browser->bookmarkbar)) _action_set_active (browser, "Bookmarkbar", TRUE); folder = browser->bookmarks; @@ -970,7 +970,7 @@ midori_browser_save_uri (MidoriBrowser* browser, gchar* last_slash; gchar* folder; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; dialog = sokoke_file_chooser_dialog_new (_("Save file as"), @@ -1604,14 +1604,14 @@ midori_view_search_text_cb (GtkWidget* view, gtk_widget_hide (GTK_WIDGET (browser->find_case)); gtk_widget_hide (GTK_WIDGET (browser->find_highlight)); gtk_widget_hide (GTK_WIDGET (browser->find_close)); - if (!GTK_WIDGET_VISIBLE (browser->find)) + if (!gtk_widget_get_visible (browser->find)) gtk_entry_set_text (GTK_ENTRY (browser->find_text), ""); gtk_widget_show (browser->find); gtk_window_set_focus (GTK_WINDOW (browser), browser->find_text); gtk_editable_insert_text (GTK_EDITABLE (browser->find_text), typing, -1, &position); gtk_editable_set_position (GTK_EDITABLE (browser->find_text), -1); } - if (GTK_WIDGET_VISIBLE (browser->find) && !typing) + if (gtk_widget_get_visible (browser->find) && !typing) { #if !HAVE_HILDON gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (browser->find_text), @@ -2247,7 +2247,7 @@ _action_open_activate (GtkAction* action, GtkWidget* dialog; GtkWidget* view; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; dialog = sokoke_file_chooser_dialog_new (_("Open file"), @@ -2362,7 +2362,7 @@ _action_compact_add_activate (GtkAction* action, "AddDesktopShortcut", "AddNewsFeed" }; guint i; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; dialog = g_object_new (GTK_TYPE_DIALOG, @@ -2416,7 +2416,7 @@ _action_print_activate (GtkAction* action, { GtkWidget* view; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; if ((view = midori_browser_get_current_tab (browser))) @@ -2576,7 +2576,7 @@ static void _action_find_activate (GtkAction* action, MidoriBrowser* browser) { - if (GTK_WIDGET_VISIBLE (browser->find)) + if (gtk_widget_get_visible (browser->find)) _midori_browser_find_done (browser); else { @@ -3302,7 +3302,7 @@ _action_preferences_activate (GtkAction* action, { static GtkWidget* dialog = NULL; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; if (!dialog) @@ -3360,8 +3360,8 @@ _action_menubar_activate (GtkToggleAction* action, sokoke_widget_set_visible (browser->menubar, active); g_object_set_data (G_OBJECT (browser), "midori-toolbars-visible", - GTK_WIDGET_VISIBLE (browser->menubar) - || GTK_WIDGET_VISIBLE (browser->navigationbar) + gtk_widget_get_visible (browser->menubar) + || gtk_widget_get_visible (browser->navigationbar) ? (void*)0xdeadbeef : NULL); } @@ -3374,8 +3374,8 @@ _action_navigationbar_activate (GtkToggleAction* action, sokoke_widget_set_visible (browser->navigationbar, active); g_object_set_data (G_OBJECT (browser), "midori-toolbars-visible", - GTK_WIDGET_VISIBLE (browser->menubar) - || GTK_WIDGET_VISIBLE (browser->navigationbar) + gtk_widget_get_visible (browser->menubar) + || gtk_widget_get_visible (browser->navigationbar) ? (void*)0xdeadbeef : NULL); } @@ -3784,7 +3784,7 @@ static void _action_location_activate (GtkAction* action, MidoriBrowser* browser) { - if (!GTK_WIDGET_VISIBLE (browser->navigationbar)) + if (!gtk_widget_get_visible (browser->navigationbar)) gtk_widget_show (browser->navigationbar); } @@ -4076,7 +4076,7 @@ _action_search_activate (GtkAction* action, while (((proxy = g_slist_nth_data (proxies, i++)))) if (GTK_IS_TOOL_ITEM (proxy)) { - if (!GTK_WIDGET_VISIBLE (browser->navigationbar)) + if (!gtk_widget_get_visible (browser->navigationbar)) gtk_widget_show (browser->navigationbar); return; } @@ -4127,7 +4127,7 @@ static void _action_search_focus_out (GtkAction* action, MidoriBrowser* browser) { - if (GTK_WIDGET_VISIBLE (browser->statusbar) && !browser->show_navigationbar) + if (gtk_widget_get_visible (browser->statusbar) && !browser->show_navigationbar) gtk_widget_hide (browser->navigationbar); } @@ -4525,7 +4525,7 @@ _action_bookmarks_import_activate (GtkAction* action, guint i; KatzeItem* item; - if (!browser->bookmarks || !GTK_WIDGET_VISIBLE (browser)) + if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser))) return; dialog = gtk_dialog_new_with_buttons ( @@ -4662,7 +4662,7 @@ _action_bookmarks_export_activate (GtkAction* action, gchar* path = NULL; GError* error; - if (!browser->bookmarks || !GTK_WIDGET_VISIBLE (browser)) + if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser))) return; file_dialog = sokoke_file_chooser_dialog_new (_("Save file as"), @@ -4693,7 +4693,7 @@ _action_manage_search_engines_activate (GtkAction* action, { static GtkWidget* dialog = NULL; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; if (!dialog) @@ -4821,7 +4821,7 @@ _action_clear_private_data_activate (GtkAction* action, { static GtkWidget* dialog = NULL; - if (!GTK_WIDGET_VISIBLE (browser)) + if (!gtk_widget_get_visible (GTK_WIDGET (browser))) return; if (!dialog) @@ -6848,7 +6848,7 @@ _midori_browser_update_settings (MidoriBrowser* browser) last_panel_position); /* The browser may not yet be visible, which means that we can't set the page. So we set it in midori_browser_size_allocate_cb */ - if (GTK_WIDGET_VISIBLE (browser)) + if (gtk_widget_get_visible (GTK_WIDGET (browser))) midori_panel_set_current_page (MIDORI_PANEL (browser->panel), last_panel_page); else g_object_set_data (G_OBJECT (browser), "last-page", diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index 5e64d0fd..9bbd710b 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -491,7 +491,7 @@ midori_location_action_popup_timeout_cb (gpointer data) searches += i; } - if (!GTK_WIDGET_VISIBLE (action->popup)) + if (!gtk_widget_get_visible (action->popup)) { GtkWidget* toplevel = gtk_widget_get_toplevel (action->entry); gtk_window_set_screen (GTK_WINDOW (action->popup), @@ -836,7 +836,7 @@ midori_location_action_button_press_event_cb (GtkEntry* entry, GdkEventKey* event, MidoriLocationAction* action) { - if (action->popup && GTK_WIDGET_VISIBLE (action->popup)) + if (action->popup && gtk_widget_get_visible (action->popup)) { midori_location_action_popdown_completion (action); @@ -868,7 +868,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry, case GDK_Right: case GDK_KP_Right: - if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) + if (location_action->popup && gtk_widget_get_visible (location_action->popup)) { GtkTreeModel* model = location_action->completion_model; GtkTreeIter iter; @@ -897,7 +897,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry, break; case GDK_Escape: { - if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) + if (location_action->popup && gtk_widget_get_visible (location_action->popup)) { midori_location_action_popdown_completion (location_action); text = gtk_entry_get_text (entry); @@ -911,7 +911,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry, } case GDK_Page_Up: case GDK_Page_Down: - if (!(location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup))) + if (!(location_action->popup && gtk_widget_get_visible (location_action->popup))) return TRUE; case GDK_Down: case GDK_KP_Down: @@ -920,7 +920,7 @@ midori_location_action_key_press_event_cb (GtkEntry* entry, { GtkWidget* parent; - if (location_action->popup && GTK_WIDGET_VISIBLE (location_action->popup)) + if (location_action->popup && gtk_widget_get_visible (location_action->popup)) { GtkTreeModel* model = location_action->completion_model; gint matches = gtk_tree_model_iter_n_children (model, NULL); diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 1698bef5..0905603e 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -657,7 +657,7 @@ midori_panel_construct_menu_item (MidoriPanel* panel, menuitem = gtk_action_create_menu_item (action); g_object_set_data (G_OBJECT (menuitem), "page", viewable); - if (GTK_WIDGET_VISIBLE (viewable)) + if (gtk_widget_get_visible (GTK_WIDGET (viewable))) gtk_widget_show (menuitem); return menuitem; } @@ -841,7 +841,7 @@ midori_panel_append_page (MidoriPanel* panel, g_signal_connect (viewable, "destroy", G_CALLBACK (midori_panel_viewable_destroy_cb), panel); - if (!GTK_WIDGET_VISIBLE (viewable)) + if (!gtk_widget_get_visible (GTK_WIDGET (viewable))) { gtk_widget_hide (scrolled); gtk_widget_hide (GTK_WIDGET (toolitem)); @@ -992,7 +992,7 @@ midori_panel_set_current_page (MidoriPanel* panel, GList* items; const gchar* label; - if (!GTK_WIDGET_VISIBLE (viewable)) + if (!gtk_widget_get_visible (viewable)) return; gtk_notebook_set_current_page (GTK_NOTEBOOK (panel->toolbook), n); diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index c46dafe7..f49fd14b 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -393,7 +393,7 @@ midori_search_action_manage_activate_cb (GtkWidget* menuitem, GtkWidget* dialog; dialog = midori_search_action_get_dialog (search_action); - if (GTK_WIDGET_VISIBLE (dialog)) + if (gtk_widget_get_visible (dialog)) gtk_window_present (GTK_WINDOW (dialog)); else gtk_widget_show (dialog); diff --git a/midori/sokoke.h b/midori/sokoke.h index e91bc692..fbd9e38c 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -38,6 +38,7 @@ #if !GTK_CHECK_VERSION (2, 18, 0) #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget) #define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget) + #define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE (widget) #endif #if !GTK_CHECK_VERSION(2, 12, 0)