summaryrefslogtreecommitdiff
path: root/src/gpm-prefs-core.c
diff options
context:
space:
mode:
authorSteve Zesch <[email protected]>2011-12-26 19:33:53 -0500
committerSteve Zesch <[email protected]>2011-12-26 19:33:53 -0500
commit67bb8c1d1446c4056fed6832ecfde5f74660ce4f (patch)
treeb9c95df313052ef2b0609f057fce022fc1b0fea6 /src/gpm-prefs-core.c
parentd9b15ee1bfcb82cd62a1a23be6d159f9cae662a0 (diff)
downloadmate-power-manager-67bb8c1d1446c4056fed6832ecfde5f74660ce4f.tar.bz2
mate-power-manager-67bb8c1d1446c4056fed6832ecfde5f74660ce4f.tar.xz
Fixed gtk_combo_box_append_text deprecation
Diffstat (limited to 'src/gpm-prefs-core.c')
-rw-r--r--src/gpm-prefs-core.c76
1 files changed, 61 insertions, 15 deletions
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c
index da43f1d..db1e546 100644
--- a/src/gpm-prefs-core.c
+++ b/src/gpm-prefs-core.c
@@ -360,29 +360,59 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name,
if (policy == GPM_ACTION_POLICY_SHUTDOWN && !prefs->priv->can_shutdown) {
egg_debug ("Cannot add option, as cannot shutdown.");
} else if (policy == GPM_ACTION_POLICY_SHUTDOWN && prefs->priv->can_shutdown) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Shutdown"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Shutdown"));
+ g_ptr_array_add(array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Shutdown"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
} else if (policy == GPM_ACTION_POLICY_SUSPEND && !prefs->priv->can_suspend) {
egg_debug ("Cannot add option, as cannot suspend.");
} else if (policy == GPM_ACTION_POLICY_HIBERNATE && !prefs->priv->can_hibernate) {
egg_debug ("Cannot add option, as cannot hibernate.");
} else if (policy == GPM_ACTION_POLICY_SUSPEND && prefs->priv->can_suspend) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Suspend"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Suspend"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Suspend"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
} else if (policy == GPM_ACTION_POLICY_HIBERNATE && prefs->priv->can_hibernate) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Hibernate"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Hibernate"));
+ g_ptr_array_add(array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Hibernate"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
} else if (policy == GPM_ACTION_POLICY_BLANK) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Blank screen"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Blank screen"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Blank screen"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
} else if (policy == GPM_ACTION_POLICY_INTERACTIVE) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Ask me"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Ask me"));
+ g_ptr_array_add(array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Ask me"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
} else if (policy == GPM_ACTION_POLICY_NOTHING) {
/* we only add do nothing in the GUI if the user has explicitly specified this in MateConf */
if (value == GPM_ACTION_POLICY_NOTHING) {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Do nothing"));
- g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Do nothing"));
+ g_ptr_array_add(array, GINT_TO_POINTER (policy));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Do nothing"));
+ g_ptr_array_add (array, GINT_TO_POINTER (policy));
+ #endif
}
} else {
egg_warning ("Unknown action read from conf: %i", policy);
@@ -442,10 +472,18 @@ gpm_prefs_setup_time_combo (GpmPrefs *prefs, const gchar *widget_name,
/* get translation for number of seconds */
if (values[i] != 0) {
text = gpm_get_timestring (values[i]);
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), text);
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX (widget), text);
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), text);
+ #endif
g_free (text);
} else {
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Never"));
+ #if gtk_check_version (2, 24, 0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX (widget), _("Never"));
+ #else
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Never"));
+ #endif
}
/* matches, so set default */
@@ -978,7 +1016,15 @@ gpm_prefs_init (GpmPrefs *prefs)
NULL);
prefs->priv->builder = gtk_builder_new ();
- retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui", &error);
+
+ #if gtk_check_version(2, 24, 0)
+ retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui",
+ &error);
+ #else
+ retval = gtk_builder_add_from_file (prefs->priv->builder,
+ GPM_DATA "/gpm-prefs-deprecated.ui", &error);
+ #endif
+
if (retval == 0) {
egg_warning ("failed to load ui: %s", error->message);
g_error_free (error);