summaryrefslogtreecommitdiff
path: root/battstat/battstat_applet.c
diff options
context:
space:
mode:
Diffstat (limited to 'battstat/battstat_applet.c')
-rw-r--r--battstat/battstat_applet.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c
index d89583ff..07203996 100644
--- a/battstat/battstat_applet.c
+++ b/battstat/battstat_applet.c
@@ -153,7 +153,7 @@ battstat_error_dialog (GtkWidget *applet,
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_widget_get_screen (GTK_WIDGET (applet)));
- g_signal_connect_swapped (G_OBJECT (dialog), "response",
+ g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (dialog));
@@ -276,10 +276,9 @@ battery_full_dialog (GtkWidget *applet)
"gtk-ok",
GTK_RESPONSE_ACCEPT,
NULL);
- g_signal_connect_swapped (G_OBJECT (dialog),
- "response",
+ g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (dialog));
+ dialog);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -438,8 +437,7 @@ battery_low_dialog (ProgressData *battery,
gtk_dialog_set_default_response (GTK_DIALOG (battery->battery_low_dialog),
GTK_RESPONSE_ACCEPT);
- g_signal_connect_swapped (G_OBJECT (battery->battery_low_dialog),
- "response",
+ g_signal_connect_swapped (battery->battery_low_dialog, "response",
G_CALLBACK (battery_low_dialog_destroy),
battery);
@@ -650,7 +648,6 @@ check_for_updates (gpointer data)
}
}
-
possibly_update_status_icon (battstat, &info);
if (!info.on_ac_power &&
@@ -678,8 +675,7 @@ check_for_updates (gpointer data)
}
if (battstat->last_charging &&
- battstat->last_acline_status &&
- battstat->last_acline_status!=1000 &&
+ battstat->last_acline_status == POWER_STATUS_ON &&
!info.charging &&
info.on_ac_power &&
info.present &&
@@ -800,7 +796,6 @@ battstat_show_help (ProgressData *battstat,
}
}
-
/* Called when the user selects the 'help' menu item.
*/
static void
@@ -850,7 +845,7 @@ about_cb (GtkAction *action, ProgressData *battstat)
"version", VERSION,
"copyright", _("Copyright \xc2\xa9 2000 The Gnulix Society\n"
"Copyright \xc2\xa9 2002-2005 Free Software Foundation and others\n"
- "Copyright \xc2\xa9 2012-2020 MATE developers"),
+ "Copyright \xc2\xa9 2012-2021 MATE developers"),
"comments", comments,
"authors", authors,
"documenters", documenters,
@@ -929,6 +924,7 @@ static void
load_preferences (ProgressData *battstat)
{
GSettings *settings = battstat->settings;
+ gdouble red_val;
if (DEBUG) g_print ("load_preferences ()\n");
@@ -937,10 +933,12 @@ load_preferences (ProgressData *battstat)
battstat->red_value_is_time = g_settings_get_boolean (settings, "red-value-is-time");
/* automatically calculate orangle and yellow values from the red value */
- battstat->orange_val = battstat->red_val * ORANGE_MULTIPLIER;
+ red_val = (gdouble) battstat->red_val;
+
+ battstat->orange_val = (guint) (ORANGE_MULTIPLIER * red_val);
battstat->orange_val = MIN (battstat->orange_val, 100);
- battstat->yellow_val = battstat->red_val * YELLOW_MULTIPLIER;
+ battstat->yellow_val = (guint) (YELLOW_MULTIPLIER * red_val);
battstat->yellow_val = MIN (battstat->yellow_val, 100);
battstat->lowbattnotification = g_settings_get_boolean (settings, "low-battery-notification");
@@ -1091,18 +1089,15 @@ create_layout (ProgressData *battstat)
gtk_widget_show_all (battstat->applet);
/* Attach all sorts of signals to the applet. */
- g_signal_connect (G_OBJECT (battstat->applet),
- "destroy",
+ g_signal_connect (battstat->applet, "destroy",
G_CALLBACK (destroy_applet),
battstat);
- g_signal_connect (battstat->applet,
- "change_orient",
+ g_signal_connect (battstat->applet, "change-orient",
G_CALLBACK (change_orient),
battstat);
- g_signal_connect (battstat->applet,
- "size_allocate",
+ g_signal_connect (battstat->applet, "size-allocate",
G_CALLBACK (size_allocate),
battstat);
@@ -1135,7 +1130,9 @@ battstat_applet_fill (MatePanelApplet *applet)
if (DEBUG) g_print ("main ()\n");
+#ifndef ENABLE_IN_PROCESS
g_set_application_name (_("Battery Charge Monitor"));
+#endif
gtk_window_set_default_icon_name ("battery");
@@ -1150,8 +1147,8 @@ battstat_applet_fill (MatePanelApplet *applet)
battstat->applet = GTK_WIDGET (applet);
battstat->refresh_label = TRUE;
battstat->last_batt_life = 1000;
- battstat->last_acline_status = 1000;
- battstat->last_charging = 1000;
+ battstat->last_acline_status = POWER_STATUS_UNKNOWN;
+ battstat->last_charging = POWER_STATUS_UNKNOWN;
battstat->orienttype = mate_panel_applet_get_orient (applet);
battstat->battery_low_dialog = NULL;
battstat->battery_low_label = NULL;
@@ -1215,10 +1212,8 @@ battstat_applet_factory (MatePanelApplet *applet,
return retval;
}
-
-MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("BattstatAppletFactory",
- PANEL_TYPE_APPLET,
- "battstat",
- battstat_applet_factory,
- NULL)
-
+PANEL_APPLET_FACTORY ("BattstatAppletFactory",
+ PANEL_TYPE_APPLET,
+ "battstat",
+ battstat_applet_factory,
+ NULL)