From f079d9c48a00199eb437651f639136eeeb9f96d8 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 18 Oct 2010 22:35:39 +0200 Subject: [PATCH] Use accessor for dialogue content area --- midori/main.c | 6 +++--- midori/midori-preferences.c | 4 ++-- midori/midori-searchaction.c | 30 +++++++++++++++--------------- midori/sokoke.h | 2 ++ 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/midori/main.c b/midori/main.c index 63aaa0a1..166e6712 100644 --- a/midori/main.c +++ b/midori/main.c @@ -923,6 +923,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings, KatzeArray* _session) { GtkWidget* dialog; + GtkWidget* content_area; GdkScreen* screen; GtkIconTheme* icon_theme; GtkWidget* box; @@ -941,6 +942,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings, "to solve the problem.")); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE); gtk_window_set_title (GTK_WINDOW (dialog), g_get_application_name ()); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); screen = gtk_widget_get_screen (dialog); if (screen) { @@ -968,7 +970,7 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings, gtk_widget_set_sensitive (button, FALSE); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 4); gtk_widget_show_all (box); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box); + gtk_container_add (GTK_CONTAINER (content_area), box); #ifdef HAVE_HILDON_2_2 box = gtk_hbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, FALSE, 4); @@ -984,14 +986,12 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings, { /* GtkLabel can't wrap the text properly. Until some day this works, we implement this hack to do it ourselves. */ - GtkWidget* content_area; GtkWidget* hbox; GtkWidget* vbox; GtkWidget* label; GList* ch; GtkRequisition req; - content_area = GTK_DIALOG (dialog)->vbox; ch = gtk_container_get_children (GTK_CONTAINER (content_area)); hbox = (GtkWidget*)g_list_nth_data (ch, 0); g_list_free (ch); diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 86214aeb..d2220c19 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -309,8 +309,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences, if ((header = sokoke_xfce_header_new (icon_name, gtk_window_get_title (GTK_WINDOW (preferences))))) { - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox), - header, FALSE, FALSE, 0); + GtkWidget* vbox = gtk_dialog_get_content_area (GTK_DIALOG (preferences)); + gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, FALSE, 0); gtk_widget_show_all (header); } _preferences = KATZE_PREFERENCES (preferences); diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index 6c4da389..2321e6d1 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -896,6 +896,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, { GtkWidget* toplevel; GtkWidget* dialog; + GtkWidget* content_area; GtkSizeGroup* sizegroup; KatzeItem* item; GtkWidget* hbox; @@ -919,8 +920,9 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, NULL); gtk_window_set_icon_name (GTK_WINDOW (dialog), new_engine ? GTK_STOCK_ADD : GTK_STOCK_REMOVE); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (content_area), 5); sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); if (new_engine) @@ -950,7 +952,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, gtk_entry_set_text (GTK_ENTRY (entry_name), STR_NON_NULL (katze_item_get_name (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_name, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); hbox = gtk_hbox_new (FALSE, 8); @@ -964,7 +966,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, gtk_entry_set_text (GTK_ENTRY (entry_description) , STR_NON_NULL (katze_item_get_text (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_description, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); hbox = gtk_hbox_new (FALSE, 8); @@ -978,7 +980,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, gtk_entry_set_text (GTK_ENTRY (entry_uri) , STR_NON_NULL (katze_item_get_uri (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); hbox = gtk_hbox_new (FALSE, 8); @@ -992,7 +994,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, gtk_entry_set_text (GTK_ENTRY (entry_icon) , STR_NON_NULL (katze_item_get_icon (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_icon, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); hbox = gtk_hbox_new (FALSE, 8); @@ -1006,7 +1008,7 @@ midori_search_action_get_editor (MidoriSearchAction* search_action, gtk_entry_set_text (GTK_ENTRY (entry_token) , STR_NON_NULL (katze_item_get_token (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_token, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); + gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); @@ -1207,6 +1209,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) const gchar* dialog_title; GtkWidget* toplevel; GtkWidget* dialog; + GtkWidget* content_area; gint width, height; GtkWidget* xfce_heading; GtkWidget* hbox; @@ -1244,6 +1247,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &search_action->dialog); gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PROPERTIES); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); /* TODO: Implement some kind of help function */ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_HELP, FALSE); @@ -1255,11 +1259,9 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) We need mnemonics */ if ((xfce_heading = sokoke_xfce_header_new ( gtk_window_get_icon_name (GTK_WINDOW (dialog)), dialog_title))) - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - xfce_heading, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (content_area), xfce_heading, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, - TRUE, TRUE, 12); + gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 12); liststore = gtk_list_store_new (1, KATZE_TYPE_ITEM); treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (liststore)); search_action->treeview = treeview; @@ -1357,12 +1359,10 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) gtk_widget_set_sensitive (button, FALSE); /* g_signal_connect (button, "clicked", G_CALLBACK (midori_search_action_dialog_help_clicked_cb), dialog); */ - gtk_box_pack_end (GTK_BOX (hbox), - button, FALSE, FALSE, 4); - gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), - hbox, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 4); + gtk_box_pack_end (GTK_BOX (content_area), hbox, FALSE, FALSE, 0); #endif - gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); + gtk_widget_show_all (content_area); if (search_action->search_engines) g_object_connect (search_action->search_engines, diff --git a/midori/sokoke.h b/midori/sokoke.h index 1788882c..fa319601 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -35,6 +35,8 @@ #if !GTK_CHECK_VERSION (2, 14, 0) #define gtk_dialog_get_content_area(dlg) dlg->vbox + #define gtk_dialog_get_action_area(dlg) dlg->action_area + #define gtk_widget_get_window(wdgt) wdgt->window #endif #if !GTK_CHECK_VERSION (2, 16, 0) -- 2.39.5