From b3344bf6f760b3869278ac294c75468e31817fcc Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 28 Nov 2011 23:37:34 +0100 Subject: [PATCH] Define H and V widget functions for GTK+3 The horizontal variants are gone from the API. gtk_rc_get_theme_dir has been deprecated, there is no replacement so we do the equivalent lookup. Right-aligned menu items are deprecated. For now defining gtk_widget_render_icon and gtk_widget_set_size_request gets rid of warnings. --- katze/gtk3-compat.h | 9 +++++++++ katze/katze-utils.h | 1 + midori/midori-browser.c | 8 ++++++++ midori/midori-websettings.c | 6 +++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/katze/gtk3-compat.h b/katze/gtk3-compat.h index c1a2dd5f..fddfe977 100644 --- a/katze/gtk3-compat.h +++ b/katze/gtk3-compat.h @@ -19,6 +19,15 @@ G_BEGIN_DECLS #define gtk_hbox_new(hmg,spc) g_object_new (GTK_TYPE_BOX, \ "homogeneous", hmg, "spacing", spc, \ "orientation", GTK_ORIENTATION_HORIZONTAL, NULL) + #define gtk_hseparator_new() g_object_new (GTK_TYPE_SEPARATOR, NULL) + #define gtk_hpaned_new() g_object_new (GTK_TYPE_PANED, NULL) + #define gtk_vpaned_new() g_object_new (GTK_TYPE_PANED, \ + "orientation", GTK_ORIENTATION_VERTICAL, NULL) + /* FIXME */ + #define gtk_widget_render_icon(wdgt, stk, sz, dtl) \ + gtk_widget_render_icon_pixbuf(wdgt, stk, sz) + #define gtk_widget_size_request(wdgt, req) \ + gtk_widget_get_preferred_size(wdgt, req, NULL) #endif #if !GLIB_CHECK_VERSION (2, 32, 0) diff --git a/katze/katze-utils.h b/katze/katze-utils.h index c00ebd7c..643b4238 100644 --- a/katze/katze-utils.h +++ b/katze/katze-utils.h @@ -15,6 +15,7 @@ #include #include "katze-array.h" +#include "gtk3-compat.h" G_BEGIN_DECLS diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 6878f1e6..b91a30dd 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2206,6 +2206,7 @@ midori_browser_class_init (MidoriBrowserClass* class) TRUE, flags)); + #if !GTK_CHECK_VERSION (3, 0, 0) /* Add 2px space between tool buttons */ gtk_rc_parse_string ( "style \"tool-button-style\"\n {\n" @@ -2214,6 +2215,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "style \"tool-button-style\"\n" "widget \"MidoriBrowser.*.MidoriFindbar.Gtk*ToolButton\" " "style \"tool-button-style\"\n"); + #endif } static void @@ -6062,7 +6064,13 @@ midori_browser_init (MidoriBrowser* browser) gtk_widget_show (browser->throbber); gtk_container_add (GTK_CONTAINER (menuitem), browser->throbber); gtk_widget_set_sensitive (menuitem, FALSE); + #if GTK_CHECK_VERSION (3, 2, 0) + /* FIXME: Doesn't work */ + gtk_widget_set_hexpand (menuitem, TRUE); + gtk_widget_set_halign (menuitem, GTK_ALIGN_END); + #else gtk_menu_item_set_right_justified (GTK_MENU_ITEM (menuitem), TRUE); + #endif gtk_menu_shell_append (GTK_MENU_SHELL (browser->menubar), menuitem); #endif browser->menu_tools = gtk_menu_new (); diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index 246dd518..83ad7fef 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -1711,9 +1711,9 @@ midori_web_settings_get_property (GObject* object, GdkScreen* screen = gdk_screen_get_default (); GtkSettings* settings = gtk_settings_get_for_screen (screen); gchar* theme = katze_object_get_string (settings, "gtk-theme-name"); - gchar* folder = gtk_rc_get_theme_dir (); - gchar* filename = g_build_filename (folder, theme, "index.theme", NULL); - g_free (folder); + gchar* theme_file = g_build_filename ("themes", theme, "index.theme", NULL); + gchar* filename = sokoke_find_data_filename (theme_file, FALSE); + g_free (theme_file); web_settings->close_buttons_left = 1; if (g_access (filename, F_OK) != 0) katze_assign (filename, -- 2.39.5