[Xfce4-commits] [xfce/thunar] 01/02: Overwrite "margin-right" of the used theme with 0 for the pathbar-buttons
noreply at xfce.org
noreply at xfce.org
Sat Sep 23 22:07:36 CEST 2017
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit c2c833ff3edfed23695fe17cb509ce4bdb13f123
Author: Alexander Schwinn <acs82 at gmx.de>
Date: Fri Sep 22 08:49:35 2017 +0200
Overwrite "margin-right" of the used theme with 0 for the
pathbar-buttons
---
thunar/thunar-application.c | 21 +++++++++++++++++++++
thunar/thunar-location-button.c | 3 +++
thunar/thunar-location-buttons.c | 8 ++++++++
3 files changed, 32 insertions(+)
diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 28457c8..c974713 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -132,6 +132,7 @@ static gboolean thunar_application_dbus_register (GApplication
GDBusConnection *connection,
const gchar *object_path,
GError **error);
+static void thunar_application_load_css (void);
static void thunar_application_accel_map_changed (ThunarApplication *application);
static gboolean thunar_application_accel_map_save (gpointer user_data);
static void thunar_application_collect_and_launch (ThunarApplication *application,
@@ -375,6 +376,8 @@ thunar_application_startup (GApplication *gapp)
thunar_application_dbus_init (application);
G_APPLICATION_CLASS (thunar_application_parent_class)->startup (gapp);
+
+ thunar_application_load_css ();
}
@@ -567,6 +570,24 @@ thunar_application_dbus_register (GApplication *gapp,
static void
+thunar_application_load_css (void)
+{
+ GtkCssProvider *css_provider;
+ GdkScreen *screen;
+
+ css_provider = gtk_css_provider_new ();
+
+ /* For the pathbar-buttons any margin looks ugly, so we overwrite "margin-right" of the used theme with 0. */
+ /* The method "gtk_widget_set_margin_right" cannot be used since style-margin is prioritized over default widget-margin by gtk3. */
+ gtk_css_provider_load_from_data (css_provider, " .path-bar-button { margin-right: 0; }", -1, NULL);
+ screen = gdk_screen_get_default ();
+ gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (css_provider);
+}
+
+
+
+static void
thunar_application_activate (GApplication *gapp)
{
/* TODO */
diff --git a/thunar/thunar-location-button.c b/thunar/thunar-location-button.c
index 8898a9b..f7eb4e5 100644
--- a/thunar/thunar-location-button.c
+++ b/thunar/thunar-location-button.c
@@ -263,6 +263,9 @@ thunar_location_button_init (ThunarLocationButton *button)
gtk_box_pack_start (GTK_BOX (hbox), button->bold_label, TRUE, TRUE, 0);
gtk_label_set_attributes (GTK_LABEL (button->bold_label), thunar_pango_attr_list_bold ());
/* but don't show it, as it is only a fake to retrieve the bold size */
+
+ /* add widget to css class which matches all buttons in the path-bar */
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (button)), "path-bar-button");
}
diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index 8bf2dab..50a6319 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -307,6 +307,14 @@ thunar_location_buttons_init (ThunarLocationButtons *buttons)
GTK_STYLE_CLASS_LINKED);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (buttons)),
"path-bar");
+
+ /* add sub-buttons to css class which matches all buttons in the path-bar */
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (buttons->left_slider)),
+ "path-bar-button");
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (buttons->right_slider)),
+ "path-bar-button");
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (buttons->filler_widget)),
+ "path-bar-button");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list