[evince] Move custom css to a file compiled as a gresource
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Move custom css to a file compiled as a gresource
- Date: Sat, 29 Sep 2012 14:19:16 +0000 (UTC)
commit d82f12769b80ee4c1696d89abb0844df9bcd8de8
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sat Sep 29 12:22:17 2012 +0200
Move custom css to a file compiled as a gresource
shell/Makefile.am | 1 +
shell/ev-window.c | 53 ++++++++++++++++++++++++++++++++++-------------------
shell/evince.css | 3 +++
3 files changed, 38 insertions(+), 19 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index ce6d7d3..18d75fc 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -159,6 +159,7 @@ evinced_LDADD= \
endif
EXTRA_DIST = \
+ evince.css \
evince-icon.rc \
evince-ui.xml \
evince-toolbar.xml \
diff --git a/shell/ev-window.c b/shell/ev-window.c
index e2c14b1..bcdbd25 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4013,24 +4013,6 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager)
}
static void
-fullscreen_toolbar_remove_shadow (GtkWidget *toolbar)
-{
- GtkCssProvider *provider;
-
- gtk_widget_set_name (toolbar, "ev-fullscreen-toolbar");
-
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
- "#ev-fullscreen-toolbar {\n"
- " -GtkToolbar-shadow-type: none; }",
- -1, NULL);
- gtk_style_context_add_provider (gtk_widget_get_style_context (toolbar),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
-}
-
-static void
ev_window_run_fullscreen (EvWindow *window)
{
gboolean fullscreen_window = TRUE;
@@ -4043,9 +4025,10 @@ ev_window_run_fullscreen (EvWindow *window)
gtk_ui_manager_get_widget (window->priv->ui_manager,
"/FullscreenToolbar");
+ gtk_widget_set_name (window->priv->fullscreen_toolbar,
+ "ev-fullscreen-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->fullscreen_toolbar),
GTK_TOOLBAR_BOTH_HORIZ);
- fullscreen_toolbar_remove_shadow (window->priv->fullscreen_toolbar);
fullscreen_toolbar_setup_item_properties (window->priv->ui_manager);
gtk_box_pack_start (GTK_BOX (window->priv->main_box),
@@ -7168,11 +7151,33 @@ handle_sync_view_cb (EvEvinceWindow *object,
}
#endif /* ENABLE_DBUS */
+static gboolean
+_gtk_css_provider_load_from_resource (GtkCssProvider *provider,
+ const char *resource_path,
+ GError **error)
+{
+ GBytes *data;
+ gboolean retval;
+
+ data = g_resources_lookup_data (resource_path, 0, error);
+ if (!data)
+ return FALSE;
+
+ retval = gtk_css_provider_load_from_data (provider,
+ g_bytes_get_data (data, NULL),
+ g_bytes_get_size (data),
+ error);
+ g_bytes_unref (data);
+
+ return retval;
+}
+
static void
ev_window_init (EvWindow *ev_window)
{
GtkActionGroup *action_group;
GtkAccelGroup *accel_group;
+ GtkCssProvider *css_provider;
GError *error = NULL;
GtkWidget *sidebar_widget;
GtkWidget *menuitem;
@@ -7275,6 +7280,16 @@ ev_window_init (EvWindow *ev_window)
&error);
g_assert_no_error (error);
+ css_provider = gtk_css_provider_new ();
+ _gtk_css_provider_load_from_resource (css_provider,
+ "/org/gnome/evince/shell/ui/evince.css",
+ &error);
+ g_assert_no_error (error);
+ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (ev_window)),
+ GTK_STYLE_PROVIDER (css_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (css_provider);
+
ev_window->priv->recent_manager = gtk_recent_manager_get_default ();
ev_window->priv->recent_action_group = NULL;
ev_window->priv->recent_ui_id = 0;
diff --git a/shell/evince.css b/shell/evince.css
new file mode 100644
index 0000000..cf70da9
--- /dev/null
+++ b/shell/evince.css
@@ -0,0 +1,3 @@
+#ev-fullscreen-toolbar {
+ -GtkToolbar-shadow-type: none;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]