diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpm-prefs-core.c | 136 | ||||
-rw-r--r-- | src/gpm-statistics.c | 82 | ||||
-rw-r--r-- | src/gpm-tray-icon.c | 5 |
3 files changed, 36 insertions, 187 deletions
diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index 6abb792..abafc6e 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -194,30 +194,6 @@ gpm_prefs_action_time_changed_cb (GtkWidget *widget, GpmPrefs *prefs) } /** - * gpm_prefs_set_combo_simple_text: - **/ -static void -gpm_prefs_set_combo_simple_text (GtkWidget *combo_box) -{ - #if !GTK_CHECK_VERSION (2, 24, 0) - GtkCellRenderer *cell; - GtkListStore *store; - - store = gtk_list_store_new (1, G_TYPE_STRING); - gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store)); - g_object_unref (store); - - cell = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell, - "text", 0, - NULL); - #else - // nothing to do with GTK_COMBO_BOX_TEXT - #endif -} - -/** * gpm_prefs_actions_destroy_cb: **/ static void @@ -246,7 +222,6 @@ gpm_prefs_setup_action_combo (GpmPrefs *prefs, const gchar *widget_name, GpmActionPolicy *actions_added; widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, widget_name)); - gpm_prefs_set_combo_simple_text (widget); value = g_settings_get_enum (prefs->priv->settings, gpm_pref_key); is_writable = g_settings_is_writable (prefs->priv->settings, gpm_pref_key); @@ -263,57 +238,27 @@ 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) - 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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Shutdown")); + g_ptr_array_add(array, GINT_TO_POINTER (policy)); } 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) { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Suspend")); + g_ptr_array_add (array, GINT_TO_POINTER (policy)); } else if (policy == GPM_ACTION_POLICY_HIBERNATE && prefs->priv->can_hibernate) { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Hibernate")); + g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else if (policy == GPM_ACTION_POLICY_BLANK) { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Blank screen")); + g_ptr_array_add (array, GINT_TO_POINTER (policy)); } else if (policy == GPM_ACTION_POLICY_INTERACTIVE) { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Ask me")); + g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else if (policy == GPM_ACTION_POLICY_NOTHING) { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Do nothing")); + g_ptr_array_add(array, GINT_TO_POINTER (policy)); } else { egg_warning ("Unknown action read from settings: %i", policy); } @@ -355,7 +300,6 @@ gpm_prefs_setup_time_combo (GpmPrefs *prefs, const gchar *widget_name, GtkWidget *widget; widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, widget_name)); - gpm_prefs_set_combo_simple_text (widget); value = g_settings_get_int (prefs->priv->settings, gpm_pref_key); is_writable = g_settings_is_writable (prefs->priv->settings, gpm_pref_key); @@ -370,18 +314,10 @@ 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_TEXT (widget), text); - #else - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), text); - #endif + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), text); g_free (text); } else { - #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 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (widget), _("Never")); } /* matches, so set default */ @@ -546,28 +482,16 @@ 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) - gtk_widget_hide(widget); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); } 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) - gtk_widget_hide(widget); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); widget = GTK_WIDGET (gtk_builder_get_object (prefs->priv->builder, "checkbutton_ac_display_dim")); - #if GTK_CHECK_VERSION (2, 24, 0) - gtk_widget_hide(widget); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); } } @@ -647,19 +571,11 @@ 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) - gtk_widget_hide(widget); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); } 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); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); } } @@ -741,11 +657,7 @@ 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); - #else - gtk_widget_hide_all (widget); - #endif + gtk_widget_hide(widget); } } @@ -980,13 +892,7 @@ gpm_prefs_init (GpmPrefs *prefs) prefs->priv->builder = gtk_builder_new (); - #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 + retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui", &error); if (retval == 0) { egg_warning ("failed to load ui: %s", error->message); diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index ea17703..795a372 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1470,31 +1470,6 @@ gpm_stats_points_checkbox_stats_cb (GtkWidget *widget, gpointer data) } /** - * gpm_stats_set_combo_simple_text: - **/ -static void -gpm_stats_set_combo_simple_text (GtkWidget *combo_box) -{ - #if GTK_CHECK_VERSION (2, 24, 0) - // nothing to do with GTK_COMBO_BOX_TEXT - return; - #else - GtkCellRenderer *cell; - GtkListStore *store; - - store = gtk_list_store_new (1, G_TYPE_STRING); - gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store)); - g_object_unref (store); - - cell = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell, - "text", 0, - NULL); - #endif -} - -/** * gpm_stats_highlight_device: **/ static void @@ -1601,11 +1576,7 @@ main (int argc, char *argv[]) /* get UI */ builder = gtk_builder_new (); - #if GTK_CHECK_VERSION (2, 24, 0) - retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics.ui", &error); - #else - retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics-deprecated.ui", &error); - #endif + retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics.ui", &error); if (retval == 0) { egg_warning ("failed to load ui: %s", error->message); @@ -1720,18 +1691,10 @@ main (int argc, char *argv[]) stats_type = GPM_STATS_CHARGE_DATA_VALUE; widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_type")); - gpm_stats_set_combo_simple_text (widget); - #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 + 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); if (g_strcmp0 (history_type, GPM_HISTORY_RATE_VALUE) == 0) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); else @@ -1740,18 +1703,10 @@ main (int argc, char *argv[]) G_CALLBACK (gpm_stats_history_type_combo_changed_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_stats_type")); - gpm_stats_set_combo_simple_text (widget); - #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 + 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); 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) @@ -1766,20 +1721,11 @@ main (int argc, char *argv[]) G_CALLBACK (gpm_stats_type_combo_changed_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_time")); - gpm_stats_set_combo_simple_text (widget); - #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_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); 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); diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index ec6aea6..ad44f83 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -95,11 +95,8 @@ gpm_tray_icon_set_tooltip (GpmTrayIcon *icon, const gchar *tooltip) g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), FALSE); g_return_val_if_fail (tooltip != NULL, FALSE); -#if GTK_CHECK_VERSION(2,15,0) gtk_status_icon_set_tooltip_text (icon->priv->status_icon, tooltip); -#else - gtk_status_icon_set_tooltip (icon->priv->status_icon, tooltip); -#endif + return TRUE; } |