Commit fffe12a4 authored by Victor Ananjevsky's avatar Victor Ananjevsky

add --css option. park gtkrc as deprecated

parent d087ec86
......@@ -746,10 +746,26 @@ main (gint argc, gchar ** argv)
is_x11 = TRUE;
#endif
/* parse custom gtkrc */
if (options.gtkrc_file)
/* parse custom css */
if (options.css)
{
GtkCssProvider *css = gtk_css_provider_new ();
if (g_file_test (options.css, G_FILE_TEST_EXISTS))
gtk_css_provider_load_from_path (css, options.css, NULL);
else
gtk_css_provider_load_from_data (css, options.css, -1, NULL);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (css),
GTK_STYLE_PROVIDER_PRIORITY_USER);
g_object_unref (css);
}
else if (options.gtkrc_file)
{
GtkCssProvider *css = gtk_css_provider_new ();
if (options.debug)
g_printerr (_("WARNING: Using gtkrc option is deprecated, please use --css instead\n"));
gtk_css_provider_load_from_path (css, options.gtkrc_file, NULL);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (css),
GTK_STYLE_PROVIDER_PRIORITY_USER);
......
......@@ -660,8 +660,10 @@ static GOptionEntry misc_options[] = {
{ "show-themes", 0, 0, G_OPTION_ARG_NONE, &themes_mode,
N_("Show list of GtkSourceView themes"), NULL },
#endif
{ "css", 0, 0, G_OPTION_ARG_STRING, &options.css,
N_("Load additional CSS settings from file or string"), N_("STRING") },
{ "gtkrc", 0, 0, G_OPTION_ARG_FILENAME, &options.gtkrc_file,
N_("Load additional GTK settings from file"), N_("FILENAME") },
N_("Load additional CSS settings from file"), N_("FILENAME") },
{ "hscroll-policy", 0, 0, G_OPTION_ARG_CALLBACK, set_scroll_policy,
N_("Set policy for horizontal scrollbars (auto, always, never)"), N_("TYPE") },
{ "vscroll-policy", 0, 0, G_OPTION_ARG_CALLBACK, set_scroll_policy,
......@@ -1465,6 +1467,7 @@ yad_options_init (void)
options.mode = YAD_MODE_MESSAGE;
options.rest_file = NULL;
options.extra_data = NULL;
options.css = NULL;
options.gtkrc_file = NULL;
#ifndef G_OS_WIN32
options.kill_parent = 0;
......
......@@ -525,6 +525,7 @@ typedef struct {
YadSourceData source_data;
#endif
gchar *css;
gchar *gtkrc_file;
GtkPolicyType hscroll_policy;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment