[Xfce4-commits] <midori:master> Move GTK+3 built-in CSS to gtk3.css
Christian Dywan
noreply at xfce.org
Sun Jul 15 00:14:01 CEST 2012
Updating branch refs/heads/master
to 81543161dfbd6f8fd13e6422c46df399cc342eb8 (commit)
from e28ccf12ac81156450f640528df97aec82382643 (commit)
commit 81543161dfbd6f8fd13e6422c46df399cc342eb8
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Jul 14 00:25:03 2012 +0200
Move GTK+3 built-in CSS to gtk3.css
data/gtk3.css | 39 +++++++++++++++++++++++++++++++++++++++
midori/midori-app.c | 26 ++++++++++++++++++++++++++
midori/midori-locationaction.c | 24 ------------------------
midori/midori-view.c | 35 +++++++++++------------------------
wscript | 2 +-
5 files changed, 77 insertions(+), 49 deletions(-)
diff --git a/data/gtk3.css b/data/gtk3.css
new file mode 100644
index 0000000..01ad05c
--- /dev/null
+++ b/data/gtk3.css
@@ -0,0 +1,39 @@
+.notebook tab .button {
+ -GtkButton-default-border: 0;
+ -GtkButton-default-outside-border: 0;
+ -GtkButton-inner-border: 0;
+ -GtkWidget-focus-line-width: 0;
+ -GtkWidget-focus-padding: 0;
+ padding: 0;
+}
+
+.entry.progressbar {
+ background-image: -gtk-gradient(linear,
+ left top, left bottom, from (@selected_bg_color), to (@selected_bg_color));
+ color: @selected_fg_color;
+}
+
+.entry.security_unknown {
+ background-image: -gtk-gradient(linear,
+ left top, left bottom, from (#ef7070), to(#ef7070));
+ color: #000;
+}
+
+.entry.security_trusted {
+ background-image: -gtk-gradient(linear,
+ left top, left bottom, from (#d1eeb9), to(#d1eeb9));
+ color: #000;
+}
+
+GtkOverlay > * {
+ padding: 4px;
+ border-style: solid;
+ border-radius: 0 5px 0 0;
+ border-width: 1px 1px 0 0;
+}
+
+GtkOverlay MidoriFindbar {
+ border-radius: 0 0 0 5px;
+ border-width: 0 0 1px 1px; /* top right bottom left */
+}
+
diff --git a/midori/midori-app.c b/midori/midori-app.c
index 0215a8f..4e8eb8b 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -228,6 +228,32 @@ _midori_app_add_browser (MidoriApp* app,
katze_array_add_item (app->browsers, browser);
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ if (app->browser == NULL)
+ {
+ gchar* filename;
+ if ((filename = midori_app_find_res_filename ("gtk3.css")))
+ {
+ GtkCssProvider* css_provider = gtk_css_provider_new ();
+ GError* error = NULL;
+ gtk_css_provider_load_from_path (css_provider, filename, &error);
+ if (error == NULL)
+ {
+ gtk_style_context_add_provider_for_screen (
+ gtk_widget_get_screen (GTK_WIDGET (browser)),
+ GTK_STYLE_PROVIDER (css_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ else
+ {
+ g_warning ("Failed to load \"%s\": %s", filename, error->message);
+ g_error_free (error);
+ }
+ g_free (filename);
+ }
+ }
+ #endif
+
app->browser = browser;
#if HAVE_UNIQUE
/* We *do not* let unique watch windows because that includes
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index ec377bd..5ded1a3 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -851,30 +851,6 @@ midori_location_action_create_tool_item (GtkAction* action)
gtk_widget_show (entry);
gtk_container_add (GTK_CONTAINER (alignment), entry);
- #if GTK_CHECK_VERSION (3, 0, 0)
- {
- static const gchar default_style[] =
- ".security_unknown {\n"
- "background-image: none;\n"
- "background-color: #ef7070;\n"
- "color: #000;\n"
- "}\n"
- ".security_trusted {\n"
- "background-image: none;\n"
- "background-color: #d1eeb9;\n"
- "color: #000;\n"
- "}\n";
- GtkCssProvider* css_provider;
- GtkStyleContext* context;
-
- css_provider = gtk_css_provider_new ();
- context = gtk_widget_get_style_context (entry);
- gtk_css_provider_load_from_data (css_provider, default_style, -1, NULL);
- gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
- }
- #endif
-
return toolitem;
}
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 50447ce..a475763 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3272,10 +3272,14 @@ midori_view_init (MidoriView* view)
gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
/* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */
+ {
+ GtkWidget* frame = gtk_frame_new (NULL);
view->overlay_label = gtk_label_new (NULL);
- gtk_widget_set_halign (view->overlay_label, GTK_ALIGN_START);
- gtk_widget_set_valign (view->overlay_label, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), view->overlay_label);
+ gtk_container_add (GTK_CONTAINER (frame), view->overlay_label);
+ gtk_widget_set_halign (frame, GTK_ALIGN_START);
+ gtk_widget_set_valign (frame, GTK_ALIGN_END);
+ gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), frame);
+ }
view->overlay_find = g_object_new (MIDORI_TYPE_FINDBAR, NULL);
gtk_widget_set_halign (view->overlay_find, GTK_ALIGN_END);
gtk_widget_set_valign (view->overlay_find, GTK_ALIGN_START);
@@ -4445,11 +4449,11 @@ midori_view_set_overlay_text (MidoriView* view,
#if GTK_CHECK_VERSION (3, 2, 0)
if (text == NULL)
- gtk_widget_hide (view->overlay_label);
+ gtk_widget_hide (gtk_widget_get_parent (view->overlay_label));
else
{
gtk_label_set_text (GTK_LABEL (view->overlay_label), text);
- gtk_widget_show (view->overlay_label);
+ gtk_widget_show (gtk_widget_get_parent (view->overlay_label));
}
#endif
}
@@ -5063,19 +5067,8 @@ midori_view_get_proxy_tab_label (MidoriView* view)
{
GtkWidget* event_box;
GtkWidget* hbox;
+ #if !GTK_CHECK_VERSION (3, 0, 0)
static const gchar style_fixup[] =
- #if GTK_CHECK_VERSION (3, 0, 0)
- "* {\n"
- "-GtkButton-default-border : 0;\n"
- "-GtkButton-default-outside-border : 0;\n"
- "-GtkButton-inner-border: 0;\n"
- "-GtkWidget-focus-line-width : 0;\n"
- "-GtkWidget-focus-padding : 0;\n"
- "padding: 0;\n"
- "}";
- GtkStyleContext* context;
- GtkCssProvider* css_provider;
- #else
"style \"midori-close-button-style\"\n"
"{\n"
"GtkWidget::focus-padding = 0\n"
@@ -5109,13 +5102,7 @@ midori_view_get_proxy_tab_label (MidoriView* view)
view->tab_close = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (view->tab_close), GTK_RELIEF_NONE);
gtk_button_set_focus_on_click (GTK_BUTTON (view->tab_close), FALSE);
- #if GTK_CHECK_VERSION (3, 0, 0)
- context = gtk_widget_get_style_context (view->tab_close);
- css_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (css_provider, style_fixup, -1, NULL);
- gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- #else
+ #if !GTK_CHECK_VERSION (3, 0, 0)
gtk_rc_parse_string (style_fixup);
gtk_widget_set_name (view->tab_close, "midori-close-button");
g_signal_connect (view->tab_close, "style-set",
diff --git a/wscript b/wscript
index dfe53ab..7123886 100644
--- a/wscript
+++ b/wscript
@@ -518,7 +518,7 @@ def build (bld):
else:
Utils.pprint ('BLUE', "logo-shade could not be rasterized.")
- for res_file in ['about.css', 'error.html', 'close.png', 'speeddial-head.html']:
+ for res_file in ['about.css', 'error.html', 'close.png', 'gtk3.css', 'speeddial-head.html']:
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/' + res_file)
if bld.env['addons']:
More information about the Xfce4-commits
mailing list