diff options
author | Stefano Karapetsas <[email protected]> | 2011-12-29 07:46:50 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2011-12-29 07:46:50 -0800 |
commit | 30cc6ca0c463d9e2233947f3231399f2d9f64667 (patch) | |
tree | df5aeaefb83c13b1ca78a5dfa8dcbf548ed0c96b | |
parent | 67bb8c1d1446c4056fed6832ecfde5f74660ce4f (diff) | |
parent | 7e7ad48eeccbee3e899f662ac8bb2fa097638efa (diff) | |
download | mate-power-manager-30cc6ca0c463d9e2233947f3231399f2d9f64667.tar.bz2 mate-power-manager-30cc6ca0c463d9e2233947f3231399f2d9f64667.tar.xz |
Merge pull request #3 from samtygier/master
this finishes off the gtk 2.24 work started by szesch
-rw-r--r-- | src/gpm-prefs-core.c | 38 | ||||
-rw-r--r-- | src/gpm-statistics.c | 66 |
2 files changed, 69 insertions, 35 deletions
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index db1e546..7304d1a 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -360,7 +360,7 @@ 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) { - #if gtk_check_version (2, 24, 0) + #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 @@ -372,7 +372,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, } 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) { - #if gtk_check_version (2, 24, 0) + #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 @@ -380,7 +380,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, g_ptr_array_add (array, GINT_TO_POINTER (policy)); #endif } else if (policy == GPM_ACTION_POLICY_HIBERNATE && prefs->priv->can_hibernate) { - #if gtk_check_version (2, 24, 0) + #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 @@ -388,7 +388,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, g_ptr_array_add (array, GINT_TO_POINTER (policy)); #endif } else if (policy == GPM_ACTION_POLICY_BLANK) { - #if gtk_check_version (2, 24, 0) + #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 @@ -396,7 +396,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, g_ptr_array_add (array, GINT_TO_POINTER (policy)); #endif } else if (policy == GPM_ACTION_POLICY_INTERACTIVE) { - #if gtk_check_version (2, 24, 0) + #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 @@ -406,7 +406,7 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, } 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) { - #if gtk_check_version (2, 24, 0) + #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 @@ -472,15 +472,15 @@ 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]); - #if gtk_check_version (2, 24, 0) - gtk_combo_box_text_append_text(GTK_COMBO_BOX (widget), text); + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), text); #else gtk_combo_box_append_text (GTK_COMBO_BOX (widget), text); #endif g_free (text); } else { - #if gtk_check_version (2, 24, 0) - gtk_combo_box_text_append_text(GTK_COMBO_BOX (widget), _("Never")); + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Never")); #else gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Never")); #endif @@ -725,7 +725,7 @@ prefs_setup_ac (GpmPrefs *prefs) if (prefs->priv->has_button_lid == FALSE) { widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "hbox_ac_lid")); - #if gtk_check_version (2, 24, 0) + #if GTK_CHECK_VERSION (2, 24, 0) gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); @@ -734,7 +734,7 @@ prefs_setup_ac (GpmPrefs *prefs) if (prefs->priv->has_lcd == FALSE) { widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "hbox_ac_brightness")); - #if gtk_check_version (2, 24, 0) + #if GTK_CHECK_VERSION (2, 24, 0) gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); @@ -742,7 +742,7 @@ prefs_setup_ac (GpmPrefs *prefs) widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "checkbutton_ac_display_dim")); - #if gtk_check_version (2, 24, 0) + #if GTK_CHECK_VERSION (2, 24, 0) gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); @@ -820,7 +820,7 @@ prefs_setup_battery (GpmPrefs *prefs) if (prefs->priv->has_button_lid == FALSE) { widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "hbox_battery_lid")); - #if gtk_check_version(2, 24, 0) + #if GTK_CHECK_VERSION(2, 24, 0) gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); @@ -828,8 +828,8 @@ prefs_setup_battery (GpmPrefs *prefs) } if (prefs->priv->has_lcd == FALSE) { widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "checkbutton_battery_display_dim")); - #if gtk_check_version(2, 24, 0) - gtk_widget_hide(widget) + #if GTK_CHECK_VERSION(2, 24, 0) + gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); #endif @@ -914,8 +914,8 @@ prefs_setup_general (GpmPrefs *prefs) if (prefs->priv->has_button_suspend == FALSE) { widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "hbox_general_suspend")); - #if gtk_check_version (2, 24, 0) - gtk_widget_hide(widget) + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_widget_hide(widget); #else gtk_widget_hide_all (widget); #endif @@ -1017,7 +1017,7 @@ gpm_prefs_init (GpmPrefs *prefs) prefs->priv->builder = gtk_builder_new (); - #if gtk_check_version(2, 24, 0) + #if GTK_CHECK_VERSION(2, 24, 0) retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui", &error); #else diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 7ac6f2e..ef1b8f0 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1287,7 +1287,11 @@ gpm_stats_history_type_combo_changed_cb (GtkWidget *widget, gpointer data) gchar *value; const gchar *axis_x = NULL; const gchar *axis_y = NULL; - value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #if GTK_CHECK_VERSION (2, 24, 0) + value = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget)); + #else + value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #endif if (g_strcmp0 (value, GPM_HISTORY_RATE_TEXT) == 0) { history_type = GPM_HISTORY_RATE_VALUE; /* TRANSLATORS: this is the X axis on the graph */ @@ -1338,7 +1342,11 @@ gpm_stats_type_combo_changed_cb (GtkWidget *widget, gpointer data) gchar *value; const gchar *axis_x = NULL; const gchar *axis_y = NULL; - value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #if GTK_CHECK_VERSION (2, 24, 0) + value = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget)); + #else + value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #endif if (g_strcmp0 (value, GPM_STATS_CHARGE_DATA_TEXT) == 0) { stats_type = GPM_STATS_CHARGE_DATA_VALUE; /* TRANSLATORS: this is the X axis on the graph for the whole battery device */ @@ -1387,7 +1395,11 @@ static void gpm_stats_range_combo_changed (GtkWidget *widget, gpointer data) { gchar *value; - value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #if GTK_CHECK_VERSION (2, 24, 0) + value = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget)); + #else + value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + #endif if (g_strcmp0 (value, GPM_HISTORY_MINUTE_TEXT) == 0) history_time = GPM_HISTORY_MINUTE_VALUE; else if (g_strcmp0 (value, GPM_HISTORY_HOUR_TEXT) == 0) @@ -1704,10 +1716,17 @@ main (int argc, char *argv[]) widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_type")); gpm_stats_set_combo_simple_text (widget); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_RATE_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_CHARGE_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_TIME_FULL_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_TIME_EMPTY_TEXT); + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_RATE_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_CHARGE_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_TIME_FULL_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_TIME_EMPTY_TEXT); + #else + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_RATE_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_CHARGE_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_TIME_FULL_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_TIME_EMPTY_TEXT); + #endif if (g_strcmp0 (history_type, GPM_HISTORY_RATE_VALUE) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); else @@ -1717,10 +1736,17 @@ main (int argc, char *argv[]) widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_stats_type")); gpm_stats_set_combo_simple_text (widget); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_CHARGE_DATA_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_CHARGE_ACCURACY_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_DISCHARGE_DATA_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_DISCHARGE_ACCURACY_TEXT); + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_STATS_CHARGE_DATA_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_STATS_CHARGE_ACCURACY_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_STATS_DISCHARGE_DATA_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_STATS_DISCHARGE_ACCURACY_TEXT); + #else + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_CHARGE_DATA_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_CHARGE_ACCURACY_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_DISCHARGE_DATA_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_STATS_DISCHARGE_ACCURACY_TEXT); + #endif if (g_strcmp0 (stats_type, GPM_STATS_CHARGE_DATA_VALUE) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); else if (g_strcmp0 (stats_type, GPM_STATS_CHARGE_DATA_VALUE) == 0) @@ -1736,11 +1762,19 @@ main (int argc, char *argv[]) widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_time")); gpm_stats_set_combo_simple_text (widget); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_MINUTE_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_HOUR_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_HOURS_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_DAY_TEXT); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_WEEK_TEXT); + #if GTK_CHECK_VERSION (2, 24, 0) + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_MINUTE_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_HOUR_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_HOURS_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_DAY_TEXT); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), GPM_HISTORY_WEEK_TEXT); + #else + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_MINUTE_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_HOUR_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_HOURS_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_DAY_TEXT); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), GPM_HISTORY_WEEK_TEXT); + #endif gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1); if (history_time == GPM_HISTORY_MINUTE_VALUE) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); |