diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-01 08:18:48 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-01 08:18:48 +0800 |
commit | ead3e47b67b3fed4619c853021748748a4cf7306 (patch) | |
tree | 7193775a8aff8e89b18c4b8d41688ab362cca226 | |
parent | bf1d0fb988392de9d355fa74cc9c471e8cf13a20 (diff) | |
download | gsoc2013-evolution-ead3e47b67b3fed4619c853021748748a4cf7306.tar.gz gsoc2013-evolution-ead3e47b67b3fed4619c853021748748a4cf7306.tar.zst gsoc2013-evolution-ead3e47b67b3fed4619c853021748748a4cf7306.zip |
Avoid gtk_rc_parse_string().
Use gtk_css_provider_load_from_data() instead.
-rw-r--r-- | widgets/e-timezone-dialog/e-timezone-dialog.c | 26 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 27 |
2 files changed, 37 insertions, 16 deletions
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c index 9fd6b91446..32194b4871 100644 --- a/widgets/e-timezone-dialog/e-timezone-dialog.c +++ b/widgets/e-timezone-dialog/e-timezone-dialog.c @@ -172,8 +172,12 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd) GtkListStore *list_store; GtkTreeIter iter; GtkCellRenderer *cell; + GtkCssProvider *css_provider; + GtkStyleContext *style_context; GHashTable *index; + const gchar *css; gint i; + GError *error = NULL; priv = etd->priv; @@ -222,14 +226,20 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd) gtk_combo_box_set_model (combo, (GtkTreeModel *) list_store); - gtk_rc_parse_string ( - "style \"e-timezone-combo-style\" {\n" - " GtkComboBox::appears-as-list = 1\n" - "}\n" - "\n" - "widget \"*.e-timezone-dialog-combo\" style \"e-timezone-combo-style\""); - - gtk_widget_set_name (priv->timezone_combo, "e-timezone-dialog-combo"); + css_provider = gtk_css_provider_new (); + css = "GtkComboBox { -GtkComboBox-appears-as-list: 1; }"; + gtk_css_provider_load_from_data (css_provider, css, -1, &error); + style_context = gtk_widget_get_style_context (priv->timezone_combo); + if (error == NULL) { + gtk_style_context_add_provider ( + style_context, + GTK_STYLE_PROVIDER (css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } else { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } + g_object_unref (css_provider); g_list_free (list_items); } diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index dce571b57a..fd2676a6b4 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -537,6 +537,10 @@ create_children (EDateEdit *dedit) AtkObject *a11y; GtkListStore *time_store; GList *cells; + GtkCssProvider *css_provider; + GtkStyleContext *style_context; + const gchar *css; + GError *error = NULL; priv = dedit->priv; @@ -581,19 +585,27 @@ create_children (EDateEdit *dedit) priv->space = gtk_drawing_area_new (); gtk_box_pack_start (GTK_BOX (dedit), priv->space, FALSE, FALSE, 2); - gtk_rc_parse_string ( - "style \"e-dateedit-timecombo-style\" {\n" - " GtkComboBox::appears-as-list = 1\n" - "}\n" - "\n" - "widget \"*.e-dateedit-timecombo\" style \"e-dateedit-timecombo-style\""); - time_store = gtk_list_store_new (1, G_TYPE_STRING); priv->time_combo = gtk_combo_box_new_with_model_and_entry ( GTK_TREE_MODEL (time_store)); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (priv->time_combo), 0); g_object_unref (time_store); + css_provider = gtk_css_provider_new (); + css = "GtkComboBox { -GtkComboBox-appears-as-list: 1; }"; + gtk_css_provider_load_from_data (css_provider, css, -1, &error); + style_context = gtk_widget_get_style_context (priv->time_combo); + if (error == NULL) { + gtk_style_context_add_provider ( + style_context, + GTK_STYLE_PROVIDER (css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } else { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); + } + g_object_unref (css_provider); + child = gtk_bin_get_child (GTK_BIN (priv->time_combo)); /* We need to make sure labels are right-aligned, since we want @@ -609,7 +621,6 @@ create_children (EDateEdit *dedit) gtk_box_pack_start (GTK_BOX (dedit), priv->time_combo, FALSE, TRUE, 0); gtk_widget_set_size_request (priv->time_combo, 110, -1); - gtk_widget_set_name (priv->time_combo, "e-dateedit-timecombo"); rebuild_time_popup (dedit); a11y = gtk_widget_get_accessible (priv->time_combo); atk_object_set_description (a11y, _("Drop-down combination box to select time")); |