From 67bb8c1d1446c4056fed6832ecfde5f74660ce4f Mon Sep 17 00:00:00 2001 From: Steve Zesch Date: Mon, 26 Dec 2011 19:33:53 -0500 Subject: Fixed gtk_combo_box_append_text deprecation --- data/gpm-prefs-deprecated.ui | 1134 ++++++++++++++++++++++++++++++++++++++++++ data/gpm-prefs.ui | 14 +- src/gpm-prefs-core.c | 76 ++- 3 files changed, 1202 insertions(+), 22 deletions(-) create mode 100644 data/gpm-prefs-deprecated.ui diff --git a/data/gpm-prefs-deprecated.ui b/data/gpm-prefs-deprecated.ui new file mode 100644 index 0000000..702b487 --- /dev/null +++ b/data/gpm-prefs-deprecated.ui @@ -0,0 +1,1134 @@ + + + + + + 1 + 1 + 61 + 1 + 5 + + + 23 + 1 + 61 + 1 + 5 + + + 41 + 100 + 1 + 5 + + + 1 + 1 + 61 + 1 + 5 + + + 23 + 1 + 61 + 1 + 5 + + + 1 + 1 + 61 + 1 + 5 + + + 23 + 1 + 61 + 1 + 5 + + + 5 + Power Management Preferences + False + center-on-parent + dialog + False + + + True + vertical + 2 + + + True + True + 6 + + + True + 12 + vertical + 12 + + + True + vertical + 6 + + + True + 0 + <b>Actions</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 12 + True + + + True + 0 + Put computer to _sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + False + False + 0 + + + + + True + 12 + True + + + True + 0 + When laptop lid is cl_osed: + True + + + False + 0 + + + + + True + + + 1 + + + + + 1 + + + + + Sp_in down hard disks when possible + True + True + False + True + True + + + False + False + 2 + + + + + + + False + 1 + + + + + False + 0 + + + + + True + vertical + 6 + + + True + 0 + <b>Display</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 5 + + + True + 12 + True + + + True + 0 + Put _display to sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + 0 + + + + + True + 12 + True + + + True + 0 + Set display _brightness to: + True + hscale_ac_brightness + + + False + 0 + + + + + True + True + adjustment3 + 0 + bottom + + + 1 + + + + + 1 + + + + + Di_m display when idle + True + True + False + True + True + + + False + False + 2 + + + + + + + 1 + + + + + False + 1 + + + + + + + True + On AC Power + + + False + + + + + True + 12 + vertical + 12 + + + True + vertical + 6 + + + True + 0 + <b>Actions</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 12 + True + + + True + 0 + Put computer to _sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + False + False + 0 + + + + + True + 12 + True + + + True + 0 + When laptop lid is cl_osed: + True + + + False + 0 + + + + + True + + + 1 + + + + + 1 + + + + + True + 12 + True + + + True + 0 + When battery po_wer is critically low: + True + + + False + 0 + + + + + True + + + 1 + + + + + 2 + + + + + Sp_in down hard disks when possible + True + True + False + True + True + + + False + False + 3 + + + + + + + False + 1 + + + + + False + 0 + + + + + True + vertical + 6 + + + True + 0 + <b>Display</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 5 + + + True + 12 + True + + + True + 0 + Put _display to sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + 0 + + + + + _Reduce backlight brightness + True + True + False + True + True + + + False + False + 1 + + + + + Di_m display when idle + True + True + False + True + True + + + False + False + 2 + + + + + + + 1 + + + + + False + 1 + + + + + 1 + + + + + True + On Battery Power + + + 1 + False + + + + + True + 12 + vertical + 12 + + + True + vertical + 6 + + + True + 0 + <b>Actions</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 12 + True + + + True + 0 + Put computer to _sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + False + False + 0 + + + + + True + 12 + True + + + True + 0 + When UPS power is l_ow: + True + + + False + 0 + + + + + True + + + 1 + + + + + 1 + + + + + True + 12 + True + + + True + 0 + When UPS power is _critically low: + True + + + False + 0 + + + + + True + + + 1 + + + + + 2 + + + + + + + False + 1 + + + + + False + 0 + + + + + True + vertical + 6 + + + True + 0 + <b>Display</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 5 + + + True + 12 + True + + + True + 0 + Put _display to sleep when inactive for: + True + + + False + 0 + + + + + True + + + 1 + + + + + 0 + + + + + + + 1 + + + + + False + 1 + + + + + 2 + + + + + True + On UPS Power + + + 2 + False + + + + + True + 12 + vertical + 12 + + + True + vertical + 6 + + + True + 0 + <b>Actions</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + True + 12 + True + + + True + 0 + When the power _button is pressed: + True + + + False + 0 + + + + + True + + + 1 + + + + + False + False + 0 + + + + + True + 12 + True + + + True + 0 + When the _suspend button is pressed: + True + + + False + 0 + + + + + True + + + 1 + + + + + 1 + + + + + + + False + 1 + + + + + False + 0 + + + + + True + vertical + 6 + + + True + 0 + <b>Notification Area</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + 6 + + + _Never display an icon + True + True + False + True + True + + + False + False + 0 + + + + + _Only display an icon when battery power is low + True + True + False + True + True + radiobutton_notification_never + + + False + False + 1 + + + + + Only display an icon when charging or _discharging + True + True + False + True + True + radiobutton_notification_never + + + False + False + 2 + + + + + Only display an icon when a battery is p_resent + True + True + False + True + True + radiobutton_notification_never + + + False + False + 3 + + + + + _Always display an icon + True + True + False + True + True + radiobutton_notification_never + + + False + False + 4 + + + + + + + 1 + + + + + False + 1 + + + + + 3 + + + + + True + General + + + 3 + False + + + + + False + 1 + + + + + True + end + + + gtk-help + True + True + True + False + Provides help about this program + True + + + False + False + 0 + True + + + + + Make Default + True + True + True + Sets this policy to be used by all users + + + False + False + 1 + + + + + gtk-close + True + True + True + True + False + Closes the program + True + + + False + False + 2 + + + + + False + end + 0 + + + + + + button_help + button_defaults + button_close + + + diff --git a/data/gpm-prefs.ui b/data/gpm-prefs.ui index 702b487..0efc33b 100644 --- a/data/gpm-prefs.ui +++ b/data/gpm-prefs.ui @@ -150,7 +150,7 @@ - + True @@ -405,7 +405,7 @@ - + True @@ -435,7 +435,7 @@ - + True @@ -674,7 +674,7 @@ - + True @@ -704,7 +704,7 @@ - + True @@ -866,7 +866,7 @@ - + True @@ -898,7 +898,7 @@ - + True 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); -- cgit v1.2.1