diff options
author | Victor Kareh <[email protected]> | 2018-05-02 06:24:14 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-05-12 22:34:36 +0200 |
commit | 683946edbdc42d9ecf97e7f6763de280aa89ece1 (patch) | |
tree | 99685e32ac31cf3cc9e9cc96ea69c67e78d7f65c | |
parent | 311ae4eb6690a2d089014622bd340aa79a33409c (diff) | |
download | mate-applets-683946edbdc42d9ecf97e7f6763de280aa89ece1.tar.bz2 mate-applets-683946edbdc42d9ecf97e7f6763de280aa89ece1.tar.xz |
battstat: Load theme icons instead of pixmaps
Also remove the outdated option for expanded view.
-rw-r--r-- | battstat/Makefile.am | 1 | ||||
-rw-r--r-- | battstat/battstat.h | 5 | ||||
-rw-r--r-- | battstat/battstat_applet.c | 588 | ||||
-rw-r--r-- | battstat/battstat_applet.ui | 74 | ||||
-rw-r--r-- | battstat/org.mate.panel.applet.battstat.gschema.xml.in | 15 | ||||
-rw-r--r-- | battstat/pixmaps.h | 632 | ||||
-rw-r--r-- | battstat/properties.c | 79 |
7 files changed, 63 insertions, 1331 deletions
diff --git a/battstat/Makefile.am b/battstat/Makefile.am index 648e0789..cc3e09c3 100644 --- a/battstat/Makefile.am +++ b/battstat/Makefile.am @@ -39,7 +39,6 @@ libexec_PROGRAMS = battstat-applet battstat_applet_SOURCES = \ battstat.h \ - pixmaps.h \ properties.c \ battstat_applet.c \ power-management.c \ diff --git a/battstat/battstat.h b/battstat/battstat.h index b0b59808..1ea8369b 100644 --- a/battstat/battstat.h +++ b/battstat/battstat.h @@ -88,8 +88,6 @@ typedef struct _ProgressData { GtkWidget *applet; /* these are used by properties.c */ - GtkWidget *radio_ubuntu_battery; - GtkWidget *radio_traditional_battery; GtkWidget *radio_text_1; GtkWidget *radio_text_2; GtkWidget *check_text; @@ -106,9 +104,6 @@ typedef struct _ProgressData { gboolean lowbattnotification; gboolean fullbattnot; gboolean beep; - gboolean draintop; - gboolean showstatus; - gboolean showbattery; AppletTextType showtext; /* label changed type (% <-> h:mm) and must be refreshed */ diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c index b98bbf8c..3925fca7 100644 --- a/battstat/battstat_applet.c +++ b/battstat/battstat_applet.c @@ -45,7 +45,6 @@ #endif #include "battstat.h" -#include "pixmaps.h" #ifndef gettext_noop #define gettext_noop(String) (String) @@ -72,168 +71,6 @@ static const GtkActionEntry battstat_menu_actions [] = { #define AC_POWER_STRING _("System is running on AC power") #define DC_POWER_STRING _("System is running on battery power") -/* The icons for Battery, Critical, AC and Charging */ -static GdkPixbuf *statusimage[STATUS_PIXMAP_NUM]; - -/* Assuming a horizontal battery, the colour is drawn into it one horizontal - line at a time as a vertical gradient. The following arrays decide where - each horizontal line starts (the length of the lines varies with the - percentage battery life remaining). -*/ -static const int pixel_offset_top[]={ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5 }; -static const int pixel_top_length[]={ 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2 }; -static const int pixel_offset_bottom[]={ 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38 }; - - -/* The following array is the colour of each line. The (slightly) varying - colours are what makes for the gradient effect. The 'dark' colours are - used to draw the end of the bar, giving it more of a 3D look. The code - assumes that all of these arrays will have the same number of elements. -*/ -static GdkColor green[] = { - {0,0x7A00,0xDB00,0x7000}, - {0,0x9100,0xE900,0x8500}, - {0,0xA000,0xF100,0x9500}, - {0,0x9600,0xEE00,0x8A00}, - {0,0x8E00,0xE900,0x8100}, - {0,0x8500,0xE500,0x7700}, - {0,0x7C00,0xDF00,0x6E00}, - {0,0x7300,0xDA00,0x6500}, - {0,0x6A00,0xD600,0x5B00}, - {0,0x6000,0xD000,0x5100}, - {0,0x5600,0xCA00,0x4600}, - {0,0x5100,0xC100,0x4200}, -}; - -static GdkColor red[] = { - {0,0xD900,0x7200,0x7400}, - {0,0xE600,0x8800,0x8C00}, - {0,0xF000,0x9600,0x9A00}, - {0,0xEB00,0x8D00,0x9100}, - {0,0xE700,0x8300,0x8800}, - {0,0xE200,0x7A00,0x7F00}, - {0,0xDD00,0x7100,0x7600}, - {0,0xD800,0x6700,0x6D00}, - {0,0xD300,0x5D00,0x6300}, - {0,0xCD00,0x5400,0x5900}, - {0,0xC800,0x4900,0x4F00}, - {0,0xC100,0x4200,0x4700}, -}; - -static GdkColor yellow[] = { - {0,0xD800,0xD900,0x7200}, - {0,0xE600,0xE500,0x8800}, - {0,0xF000,0xEF00,0x9600}, - {0,0xEB00,0xEA00,0x8D00}, - {0,0xE700,0xE600,0x8300}, - {0,0xE200,0xE100,0x7A00}, - {0,0xDD00,0xDC00,0x7100}, - {0,0xD800,0xD700,0x6700}, - {0,0xD300,0xD200,0x5D00}, - {0,0xCD00,0xCC00,0x5400}, - {0,0xC800,0xC600,0x4900}, - {0,0xC100,0xBF00,0x4200}, -}; - -static GdkColor orange[] = { - {0,0xD900,0xAD00,0x7200}, - {0,0xE600,0xBB00,0x8800}, - {0,0xF000,0xC700,0x9600}, - {0,0xEB00,0xC000,0x8D00}, - {0,0xE700,0xB900,0x8300}, - {0,0xE200,0xB300,0x7A00}, - {0,0xDD00,0xAB00,0x7100}, - {0,0xD800,0xA400,0x6700}, - {0,0xD300,0x9E00,0x5D00}, - {0,0xCD00,0x9600,0x5400}, - {0,0xC800,0x8D00,0x4900}, - {0,0xC100,0x8600,0x4200}, -}; - -static GdkColor darkgreen[] = { - {0,0x6500,0xC600,0x5B00}, - {0,0x7B00,0xD300,0x6F00}, - {0,0x8A00,0xDB00,0x7F00}, - {0,0x8000,0xD800,0x7400}, - {0,0x7800,0xD400,0x6B00}, - {0,0x6F00,0xCF00,0x6200}, - {0,0x6600,0xCA00,0x5900}, - {0,0x5D00,0xC500,0x5000}, - {0,0x5400,0xC100,0x4600}, - {0,0x4B00,0xBB00,0x3C00}, - {0,0x4100,0xB600,0x3100}, - {0,0x3C00,0xAC00,0x2D00}, -}; - -static GdkColor darkorange[] = { - {0,0xC400,0x9700,0x5C00}, - {0,0xD000,0xA500,0x7200}, - {0,0xDA00,0xB100,0x8000}, - {0,0xD500,0xAA00,0x7700}, - {0,0xD100,0xA300,0x6D00}, - {0,0xCD00,0x9D00,0x6400}, - {0,0xC700,0x9600,0x5B00}, - {0,0xC300,0x8F00,0x5200}, - {0,0xBE00,0x8800,0x4800}, - {0,0xB800,0x8100,0x3F00}, - {0,0xB300,0x7900,0x3400}, - {0,0xAC00,0x7200,0x2D00}, -}; - -static GdkColor darkyellow[] = { - {0,0xC200,0xC400,0x5C00}, - {0,0xD000,0xCF00,0x7200}, - {0,0xDA00,0xD900,0x8000}, - {0,0xD500,0xD400,0x7700}, - {0,0xD100,0xD000,0x6D00}, - {0,0xCD00,0xCB00,0x6400}, - {0,0xC700,0xC600,0x5B00}, - {0,0xC300,0xC200,0x5200}, - {0,0xBE00,0xBD00,0x4800}, - {0,0xB800,0xB700,0x3F00}, - {0,0xB300,0xB200,0x3400}, - {0,0xAC00,0xAA00,0x2D00}, -}; - -static GdkColor darkred[] = { - {0,0xC900,0x6200,0x6400}, - {0,0xD600,0x7800,0x7C00}, - {0,0xDA00,0x8000,0x8500}, - {0,0xD500,0x7700,0x7B00}, - {0,0xD100,0x6D00,0x7200}, - {0,0xCD00,0x6400,0x6900}, - {0,0xC700,0x5B00,0x6100}, - {0,0xC300,0x5200,0x5700}, - {0,0xBE00,0x4800,0x4E00}, - {0,0xB800,0x3F00,0x4400}, - {0,0xB100,0x3200,0x3700}, - {0,0xA200,0x3200,0x3700}, -}; - -/* Initialise the global static variables that store our status pixmaps from - their XPM format (as stored in pixmaps.h). This should only be done once - since they are global variables. -*/ -/* FIXME: We should be using named icons here... */ -static void -initialise_global_pixmaps( void ) -{ - statusimage[STATUS_PIXMAP_BATTERY] = - gdk_pixbuf_new_from_xpm_data ((const char **) battery_small_xpm); - - statusimage[STATUS_PIXMAP_METER] = - gdk_pixbuf_new_from_xpm_data ((const char **) battery_small_meter_xpm); - - statusimage[STATUS_PIXMAP_AC] = - gdk_pixbuf_new_from_xpm_data ((const char **) ac_small_xpm); - - statusimage[STATUS_PIXMAP_CHARGE] = - gdk_pixbuf_new_from_xpm_data ((const char **) charge_small_xpm); - - statusimage[STATUS_PIXMAP_WARNING] = - gdk_pixbuf_new_from_xpm_data ((const char **) warning_small_xpm); -} - /* Our backends may be either event driven or poll-based. * If they are event driven then we know this the first time we * receive an event. @@ -284,7 +121,6 @@ static_global_initialisation (ProgressData *battstat) if (!first_time) return NULL; - initialise_global_pixmaps(); err = power_management_initialise (status_change_callback); return err; @@ -393,17 +229,17 @@ battery_full_notify (GtkWidget *applet) if (!notify_is_initted () && !notify_init (_("Battery Monitor"))) return FALSE; - icon = gtk_icon_theme_load_icon ( + icon = gtk_icon_theme_load_icon_for_scale ( gtk_icon_theme_get_default (), "battery", 48, + gtk_widget_get_scale_factor (applet), GTK_ICON_LOOKUP_USE_BUILTIN, NULL); NotifyNotification *n = notify_notification_new (_("Your battery is now fully recharged"), "", /* "battery" */ NULL); - /* XXX: it would be nice to pass this as a named icon */ - notify_notification_set_icon_from_pixbuf (n, icon); + notify_notification_set_image_from_pixbuf (n, icon); g_object_unref (icon); result = notify_notification_show (n, &error); @@ -432,7 +268,7 @@ battery_full_dialog (GtkWidget *applet) return; GtkWidget *dialog, *hbox, *image, *label; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; gchar *new_label; dialog = gtk_dialog_new_with_buttons ( @@ -448,14 +284,16 @@ battery_full_dialog (GtkWidget *applet) gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - pixbuf = gtk_icon_theme_load_icon ( + surface = gtk_icon_theme_load_surface ( gtk_icon_theme_get_default (), "battery", 48, + gtk_widget_get_scale_factor (applet), + NULL, GTK_ICON_LOOKUP_USE_BUILTIN, NULL); - image = gtk_image_new_from_pixbuf (pixbuf); - g_object_unref (pixbuf); + image = gtk_image_new_from_surface (surface); + cairo_surface_destroy (surface); gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 6); new_label = g_strdup_printf ( "<span weight=\"bold\" size=\"larger\">%s</span>", @@ -584,7 +422,7 @@ battery_low_dialog( ProgressData *battery, BatteryStatus *info ) { GtkWidget *hbox, *image, *label; GtkWidget *vbox; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; /* If the dialog is already displayed then don't display it again. */ if( battery->battery_low_dialog != NULL ) @@ -609,13 +447,15 @@ battery_low_dialog( ProgressData *battery, BatteryStatus *info ) 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (), "battery", 48, + gtk_widget_get_scale_factor (GTK_WIDGET (hbox)), + NULL, GTK_ICON_LOOKUP_USE_BUILTIN, NULL); - image = gtk_image_new_from_pixbuf (pixbuf); - g_object_unref (pixbuf); + image = gtk_image_new_from_surface (surface); + cairo_surface_destroy (surface); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0); @@ -675,157 +515,6 @@ update_tooltip( ProgressData *battstat, BatteryStatus *info ) g_free (tiptext); } -static void -pixbuf_draw_line( GdkPixbuf *pixbuf, GdkColor *colour, int x1, int y1, int x2, int y2) -{ - guchar *pixels = gdk_pixbuf_get_pixels (pixbuf); - int stride = gdk_pixbuf_get_rowstride (pixbuf); - int channels = gdk_pixbuf_get_n_channels (pixbuf); - guchar r, g, b, a; - int i, n; - - r = colour->red >> 8; - g = colour->green >> 8; - b = colour->blue >> 8; - a = 0xFF; - - pixels += stride * y1 + 4 * x1; - - if (x1 == x2) - { - /* stride = gdk_pixbuf_get_rowstride (pixbuf); */ - n = y2 - y1; - } - else if (y1 == y2) - { - stride = gdk_pixbuf_get_n_channels (pixbuf); - n = x2 - x1; - } - else - g_assert_not_reached (); - - for (i = 0; i < n; i++) - { - pixels[0] = r; - pixels[1] = g; - pixels[2] = b; - if (channels == 4) - pixels[3] = a; - - pixels += stride; - } -} - -/* Redraw the battery meter image. - */ -static void -update_battery_image (ProgressData *battstat, int batt_percent, int batt_time) -{ - GdkColor *color, *darkcolor; - GdkPixbuf *pixbuf; - guint progress_value; - gint i, x; - int batt_life; - - if (!battstat->showbattery) - return; - - batt_life = !battstat->red_value_is_time ? batt_percent : batt_time; - - if (batt_life <= battstat->red_val) - { - color = red; - darkcolor = darkred; - } - else if (batt_life <= battstat->orange_val) - { - color = orange; - darkcolor = darkorange; - } - else if (batt_life <= battstat->yellow_val) - { - color = yellow; - darkcolor = darkyellow; - } - else - { - color = green; - darkcolor = darkgreen; - } - - /* Depending on if the meter is horizontally oriented start out with the - appropriate XPM image (from pixmaps.h) - */ - if (battstat->horizont) - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) battery_gray_xpm); - else - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) battery_y_gray_xpm); - - /* The core code responsible for painting the battery meter. For each - colour in our gradient array, draw a vertical or horizontal line - depending on the current orientation of the meter. - */ - if (battstat->draintop) { - progress_value = PROGLEN * batt_life / 100.0; - - for( i = 0; i < G_N_ELEMENTS( orange ); i++ ) - { - if (battstat->horizont) - pixbuf_draw_line (pixbuf, &color[i], pixel_offset_top[i], i + 2, - pixel_offset_top[i] + progress_value, i + 2); - else - pixbuf_draw_line (pixbuf, &color[i], i + 2, pixel_offset_top[i], - i + 2, pixel_offset_top[i] + progress_value); - } - } - else - { - progress_value = PROGLEN * batt_life / 100.0; - - for( i = 0; i < G_N_ELEMENTS( orange ); i++) - { - if (battstat->horizont) - pixbuf_draw_line (pixbuf, &color[i], pixel_offset_bottom[i], i + 2, - pixel_offset_bottom[i] - progress_value, i + 2); - else - pixbuf_draw_line (pixbuf, &color[i], i + 2, - pixel_offset_bottom[i] - 1, i + 2, - pixel_offset_bottom[i] - progress_value); - } - - for( i = 0; i < G_N_ELEMENTS( orange ); i++ ) - { - x = pixel_offset_bottom[i] - progress_value - pixel_top_length[i]; - if (x < pixel_offset_top[i]) - x = pixel_offset_top[i]; - - if (progress_value < 33) - { - if (battstat->horizont) - pixbuf_draw_line (pixbuf, &darkcolor[i], - pixel_offset_bottom[i] - progress_value - 1, - i + 2, x, i + 2); - else - pixbuf_draw_line (pixbuf, &darkcolor[i], i + 2, - pixel_offset_bottom[i] - progress_value - 1, - i + 2, x); - } - } - } - - /* Store our newly created pixmap into the GtkImage. This results in - the last reference to the old pixmap/mask being dropped. - */ - gtk_image_set_from_pixbuf( GTK_IMAGE(battstat->battery), - pixbuf); - - /* The GtkImage does not assume a reference to the pixmap or mask; - you still need to unref them if you own references. GtkImage will - add its own reference rather than adopting yours. - */ - g_object_unref( G_OBJECT(pixbuf) ); -} - /* Update the text label that either shows the percentage of time left. */ static void @@ -861,98 +550,57 @@ update_percent_label( ProgressData *battstat, BatteryStatus *info ) static void possibly_update_status_icon( ProgressData *battstat, BatteryStatus *info ) { - StatusPixmapIndex pixmap_index; - int batt_life, last_batt_life; + GtkIconTheme *theme; + cairo_surface_t *surface; + gint icon_size, icon_scale; + gchar *icon_name; + int batt_life; batt_life = !battstat->red_value_is_time ? info->percent : info->minutes; - last_batt_life = !battstat->red_value_is_time ? battstat->last_batt_life : - battstat->last_minutes; - if( info->on_ac_power ) + if (batt_life <= battstat->red_val) { - if( info->charging ) - pixmap_index = STATUS_PIXMAP_CHARGE; + if (info->charging) + icon_name = g_strdup("battery-caution-charging"); else - pixmap_index = STATUS_PIXMAP_AC; + icon_name = g_strdup("battery-caution"); } - else /* on battery */ + else if (batt_life <= battstat->orange_val) { - if (batt_life > battstat->red_val) - pixmap_index = STATUS_PIXMAP_BATTERY; + if (info->charging) + icon_name = g_strdup("battery-low-charging"); else - pixmap_index = STATUS_PIXMAP_WARNING; + icon_name = g_strdup("battery-low"); } - - /* If we are showing the full length battery meter then the status icon - should display static icons. If we are not showing the full meter - then the status icon will show a smaller meter if we are on battery. - */ - if( !battstat->showbattery && - (pixmap_index == STATUS_PIXMAP_BATTERY || - pixmap_index == STATUS_PIXMAP_WARNING) ) - pixmap_index = STATUS_PIXMAP_METER; - - - /* Take care of drawing the smaller meter. */ - if( pixmap_index == STATUS_PIXMAP_METER && - (batt_life != last_batt_life || - battstat->last_pixmap_index != STATUS_PIXMAP_METER) ) + else if (batt_life <= battstat->yellow_val) { - GdkColor *colour; - GdkPixbuf *meter; - guint progress_value; - gint i, x; - - /* Pull in a clean version of the icons so that we don't paint over - top of the same icon over and over. We neglect to free/update the - statusmask here since it will always stay the same. - */ - meter = gdk_pixbuf_copy ( statusimage[STATUS_PIXMAP_METER]); - - if (batt_life <= battstat->red_val) - { - colour = red; - } - else if (batt_life <= battstat->orange_val) - { - colour = orange; - } - else if (batt_life <= battstat->yellow_val) - { - colour = yellow; - } + if (info->charging) + icon_name = g_strdup("battery-good-charging"); else - { - colour = green; - } + icon_name = g_strdup("battery-good"); + } + else if (info->on_ac_power) + { + if (info->charging) + icon_name = g_strdup("battery-full-charging"); + else + icon_name = g_strdup("battery-full-charged"); + } + else + { + icon_name = g_strdup("battery-full"); + } - progress_value = 12 * info->percent / 100.0; + theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (battstat->applet))); - for( i = 0; i < 10; i++ ) - { - if( i >= 2 && i <= 7 ) - x = 17; - else - x = 16; - - pixbuf_draw_line( meter, &colour[(i * 13 / 10)], - i + 1, x - progress_value, - i + 1, x ); - } + icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (battstat->applet)); + icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (battstat->applet)); - /* force a redraw immediately */ - gtk_image_set_from_pixbuf( GTK_IMAGE (battstat->status), meter); + surface = gtk_icon_theme_load_surface (theme, icon_name, icon_size, icon_scale, NULL, 0, NULL); + g_free (icon_name); - /* free our private pixmap copy */ - g_object_unref( G_OBJECT( meter ) ); - battstat->last_pixmap_index = STATUS_PIXMAP_METER; - } - else if( pixmap_index != battstat->last_pixmap_index ) - { - gtk_image_set_from_pixbuf (GTK_IMAGE (battstat->status), - statusimage[pixmap_index]); - battstat->last_pixmap_index = pixmap_index; - } + gtk_image_set_from_surface (GTK_IMAGE(battstat->status), surface); + cairo_surface_destroy (surface); } /* Gets called as a gtk_timeout once per second. Checks for updates and @@ -1016,12 +664,8 @@ check_for_updates( gpointer data ) battery_low_dialog(battstat, &info); if(battstat->beep) - gdk_beep(); + gdk_display_beep (gdk_display_get_default ()); } -#if 0 - /* FIXME: mate-applets doesn't depend on libmate anymore */ - mate_triggers_do ("", NULL, "battstat_applet", "LowBattery", NULL); -#endif } if( battstat->last_charging && @@ -1033,17 +677,12 @@ check_for_updates( gpointer data ) info.percent > 99) { /* Inform that battery now fully charged */ -#if 0 - /* FIXME: mate-applets doesn't depend on libmate anymore */ - mate_triggers_do ("", NULL, "battstat_applet", "BatteryFull", NULL); -#endif - if(battstat->fullbattnot) { battery_full_dialog (battstat->applet); if (battstat->beep) - gdk_beep(); + gdk_display_beep (gdk_display_get_default ()); } } @@ -1066,12 +705,6 @@ check_for_updates( gpointer data ) battery_low_update_text( battstat, &info ); } - if( info.percent != battstat->last_batt_life ) - { - /* Update the battery meter image */ - update_battery_image (battstat, info.percent, info.minutes); - } - if( (battstat->showtext == APPLET_SHOW_PERCENT && battstat->last_batt_life != info.percent) || (battstat->showtext == APPLET_SHOW_TIME && @@ -1116,7 +749,6 @@ destroy_applet( GtkWidget *widget, ProgressData *battstat ) g_object_unref( G_OBJECT(battstat->status) ); g_object_unref( G_OBJECT(battstat->percent) ); - g_object_unref( G_OBJECT(battstat->battery) ); g_free( battstat ); @@ -1278,7 +910,6 @@ size_allocate( MatePanelApplet *applet, GtkAllocation *allocation, static void load_preferences(ProgressData *battstat) { - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); GSettings *settings = battstat->settings; if (DEBUG) g_print("load_preferences()\n"); @@ -1297,15 +928,6 @@ load_preferences(ProgressData *battstat) battstat->lowbattnotification = g_settings_get_boolean (settings, "low-battery-notification"); battstat->fullbattnot = g_settings_get_boolean (settings, "full-battery-notification"); battstat->beep = g_settings_get_boolean (settings, "beep"); - battstat->draintop = g_settings_get_boolean (settings, "drain-from-top"); - - battstat->showstatus = g_settings_get_boolean (settings, "show-status"); - battstat->showbattery = g_settings_get_boolean (settings, "show-battery"); - - /* for miagration from older versions */ - if (battstat->showstatus && battstat->showbattery) - battstat->showbattery = FALSE; - battstat->showtext = g_settings_get_int (settings, "show-text"); } @@ -1359,90 +981,28 @@ grid_layout_attach (GtkGrid *grid, LayoutLocation loc, GtkWidget *child) void reconfigure_layout( ProgressData *battstat ) { - gboolean up_down_order = FALSE; - gboolean do_square = FALSE; LayoutConfiguration c; - int battery_horiz = 0; - int needwidth; - /* Decide if we are doing to do 'square' mode. */ + /* Default to no elements being displayed. */ + c.status = c.text = LAYOUT_NONE; + switch( battstat->orienttype ) { case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: - up_down_order = TRUE; - - /* Need to be at least 46px tall to do square mode on a horiz. panel */ - if( battstat->height >= 46 ) - do_square = TRUE; + /* Stack horizontally for top and bottom panels. */ + c.status = LAYOUT_LEFT; + if( battstat->showtext ) + c.text = LAYOUT_RIGHT; break; case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: - /* We need 64px to fix the text beside anything. */ - if( battstat->showtext ) - needwidth = 64; - /* We need 48px to fix the icon and battery side-by-side. */ - else - needwidth = 48; - - if( battstat->width >= needwidth ) - do_square = TRUE; - break; - } - - /* Default to no elements being displayed. */ - c.status = c.text = c.battery = LAYOUT_NONE; - - if( do_square ) - { - /* Square mode is only useful if we have the battery meter shown. */ - if( battstat->showbattery ) - { - c.battery = LAYOUT_LONG; - - /* if( battstat->showstatus ) */ /* make this always true */ - c.status = LAYOUT_TOPLEFT; - - if( battstat->showtext ) - c.text = LAYOUT_LEFT; - } - else - { - /* We have enough room to do 'square' mode but the battery meter is - not requested. We can, instead, take up the extra space by stacking - our items in the opposite order that we normally would (ie: stack - horizontally on a vertical panel and vertically on horizontal). - */ - up_down_order = !up_down_order; - do_square = FALSE; - } - } - - if( !do_square ) - { - if( up_down_order ) - { - /* Stack horizontally for top and bottom panels. */ - /* if( battstat->showstatus ) */ /* make this always true */ - c.status = LAYOUT_LEFT; - if( battstat->showbattery ) - c.battery = LAYOUT_CENTRE; - if( battstat->showtext ) - c.text = LAYOUT_RIGHT; - - battery_horiz = 1; - } - else - { /* Stack vertically for left and right panels. */ - /* if( battstat->showstatus ) */ /* make this always true */ - c.status = LAYOUT_TOP; - if( battstat->showbattery ) - c.battery = LAYOUT_CENTRE; + c.status = LAYOUT_TOP; if( battstat->showtext ) - c.text = LAYOUT_BOTTOM; - } + c.text = LAYOUT_BOTTOM; + break; } if( memcmp( &c, &battstat->layout, sizeof (LayoutConfiguration) ) ) @@ -1456,14 +1016,9 @@ reconfigure_layout( ProgressData *battstat ) if( battstat->layout.status ) gtk_container_remove( GTK_CONTAINER( battstat->grid ), battstat->status ); - if( battstat->layout.battery ) - gtk_container_remove( GTK_CONTAINER( battstat->grid ), - battstat->battery ); /* Attach the elements to their new locations. */ grid_layout_attach( GTK_GRID(battstat->grid), - c.battery, battstat->battery ); - grid_layout_attach( GTK_GRID(battstat->grid), c.status, battstat->status ); grid_layout_attach( GTK_GRID(battstat->grid), c.text, battstat->percent ); @@ -1471,17 +1026,6 @@ reconfigure_layout( ProgressData *battstat ) gtk_widget_show_all( battstat->applet ); } - /* If we are showing the battery meter and we weren't showing it before or - if the orientation has changed, we had better update it right now. - */ - if( (c.battery && !battstat->layout.battery) || - battery_horiz != battstat->horizont ) - { - battstat->horizont = battery_horiz; - update_battery_image (battstat, - battstat->last_batt_life, battstat->last_minutes); - } - battstat->layout = c; /* Check for generic updates. This is required, for example, to make sure @@ -1506,7 +1050,6 @@ create_layout(ProgressData *battstat) battstat->grid = gtk_grid_new (); battstat->percent = gtk_label_new( "" ); battstat->status = gtk_image_new(); - battstat->battery = gtk_image_new(); /* When you first get a pointer to a newly created GtkWidget it has one 'floating' reference. When you first add this widget to a container @@ -1518,15 +1061,12 @@ create_layout(ProgressData *battstat) */ g_object_ref( battstat->status ); g_object_ref( battstat->percent ); - g_object_ref( battstat->battery ); g_object_ref_sink( G_OBJECT( battstat->status ) ); g_object_ref_sink( G_OBJECT( battstat->percent ) ); - g_object_ref_sink( G_OBJECT( battstat->battery ) ); /* Let reconfigure_layout know that the grid is currently empty. */ battstat->layout.status = LAYOUT_NONE; battstat->layout.text = LAYOUT_NONE; - battstat->layout.battery = LAYOUT_NONE; /* Put the grid directly inside the applet and show everything. */ gtk_widget_set_halign (battstat->grid, GTK_ALIGN_CENTER); @@ -1580,10 +1120,8 @@ battstat_applet_fill (MatePanelApplet *applet) battstat->refresh_label = TRUE; battstat->last_batt_life = 1000; battstat->last_acline_status = 1000; - battstat->last_pixmap_index = 1000; battstat->last_charging = 1000; battstat->orienttype = mate_panel_applet_get_orient (applet); - battstat->horizont = TRUE; battstat->battery_low_dialog = NULL; battstat->battery_low_label = NULL; battstat->timeout = -1; diff --git a/battstat/battstat_applet.ui b/battstat/battstat_applet.ui index af5e9a87..5b892502 100644 --- a/battstat/battstat_applet.ui +++ b/battstat/battstat_applet.ui @@ -60,80 +60,6 @@ <property name="visible">True</property> <property name="spacing">12</property> <child> - <object class="GtkVBox" id="vbox21"> - <property name="visible">True</property> - <child> - <object class="GtkRadioButton" id="battery_view"> - <property name="label" translatable="yes">_Compact view</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label24"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">24</property> - <property name="label" translatable="yes">(shows single image for status and charge)</property> - <attributes> - <attribute name="scale" value="0.800000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="battery_view_2"> - <property name="label" translatable="yes">_Expanded view</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">battery_view</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label25"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">24</property> - <property name="label" translatable="yes">(two images: one for status, one for charge)</property> - <attributes> - <attribute name="scale" value="0.800000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> <object class="GtkVBox" id="vbox22"> <property name="visible">True</property> <property name="spacing">6</property> diff --git a/battstat/org.mate.panel.applet.battstat.gschema.xml.in b/battstat/org.mate.panel.applet.battstat.gschema.xml.in index 7deb8d54..c061e70d 100644 --- a/battstat/org.mate.panel.applet.battstat.gschema.xml.in +++ b/battstat/org.mate.panel.applet.battstat.gschema.xml.in @@ -25,21 +25,6 @@ <summary>Beep for warnings</summary> <description>Beep when displaying a warning.</description> </key> - <key name="drain-from-top" type="b"> - <default>false</default> - <summary>Drain from top</summary> - <description>Show the battery meter draining from the top of the battery. Only implemented for traditional battery view.</description> - </key> - <key name="show-status" type="b"> - <default>true</default> - <summary>Upright (small) battery</summary> - <description>Show the upright, smaller battery on the panel.</description> - </key> - <key name="show-battery" type="b"> - <default>false</default> - <summary>Show the horizontal battery</summary> - <description>Show the traditional, horizontal battery on the panel.</description> - </key> <key name="show-text" type="i"> <default>0</default> <summary>Show the time/percent label</summary> diff --git a/battstat/pixmaps.h b/battstat/pixmaps.h deleted file mode 100644 index 818668a5..00000000 --- a/battstat/pixmaps.h +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright (C) 2000 by Jörgen Pehrson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. - * - $Id$ - */ - -/* XPM */ -static char * battery_y_gray_xpm[] = { -"16 40 34 1", -" c None", -". c #000000", -"+ c #F0E7DF", -"@ c #E7DBD0", -"# c #D5C4B6", -"$ c #9F8672", -"% c #76553B", -"& c #B4A08F", -"* c #826249", -"= c #ABABAB", -"- c #BFAC9C", -"; c #A2A2A2", -"> c #C4C4C4", -", c #D3D3D3", -"' c #AEAEAE", -") c #A8A8A8", -"! c #DEDEDE", -"~ c #D8D8D8", -"{ c #CDCDCD", -"] c #C7C7C7", -"^ c #C1C1C1", -"/ c #BBBBBB", -"( c #B5B5B5", -"_ c #CFCFCF", -": c #C9C9C9", -"< c #BFBFBF", -"[ c #B9B9B9", -"} c #B4B4B4", -"| c #B6B6B6", -"1 c #9C9C9C", -"2 c #9F9F9F", -"3 c #D7D7D7", -"4 c #979797", -"5 c #D5D5D5", -" .... ", -" ...+@#$... ", -" ..##$@#$$%$$.. ", -".@&&##$$*%$$$$#.", -".=@@&&------##;.", -".=>,@@@@####');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,!~,{]^/(');.", -".=>,_:><[}')');.", -".=|>!~,{]^/(;1;.", -".2>,!3,{]^/(')4.", -" .>,!5,{]^/('). ", -" ..!~,{]^/(.. ", -" ........ "}; - -/* XPM */ -static char * ac_small_xpm[] = { -"12 20 88 1", -" c None", -". c #515337", -"+ c #A3A669", -"@ c #28291B", -"# c #BFBF40", -"$ c #808000", -"% c #D4D42B", -"& c #404000", -"* c #101111", -"= c #3E3E28", -"- c #4A4C4D", -"; c #424445", -"> c #B9BA53", -", c #747527", -"' c #64676A", -") c #A1A491", -"! c #C9CA52", -"~ c #3A3A14", -"{ c #717578", -"] c #B0B4B7", -"^ c #929353", -"/ c #626465", -"( c #9FA2A6", -"_ c #BDC0AE", -": c #7B7B52", -"< c #515355", -"[ c #A2A6AA", -"} c #868A8E", -"| c #B4B8BB", -"1 c #B5B8B2", -"2 c #C3C7CB", -"3 c #C2C6C6", -"4 c #B0B3B0", -"5 c #8A8E92", -"6 c #6F7275", -"7 c #333435", -"8 c #A3A7AB", -"9 c #BABEC2", -"0 c #B0B4B8", -"a c #B5B9BD", -"b c #AEB2B6", -"c c #999DA1", -"d c #151516", -"e c #BEC2C6", -"f c #B8BCC0", -"g c #BBBFC3", -"h c #CCD0D4", -"i c #C7CBCF", -"j c #434547", -"k c #DDE1E5", -"l c #E1E5E9", -"m c #D3D7DB", -"n c #C5C9CD", -"o c #000000", -"p c #95999D", -"q c #CFD3D7", -"r c #BFC3C7", -"s c #D0D4D8", -"t c #D4D8DC", -"u c #3D3F41", -"v c #3C3D3E", -"w c #2E2F30", -"x c #75777A", -"y c #9DA0A3", -"z c #676A6D", -"A c #1D1E1F", -"B c #4B4D4E", -"C c #262627", -"D c #4F5153", -"E c #121212", -"F c #5F6264", -"G c #B1B5B9", -"H c #404244", -"I c #808285", -"J c #434546", -"K c #6A6D70", -"L c #84878A", -"M c #454749", -"N c #7E8184", -"O c #C6CACE", -"P c #CED2D6", -"Q c #B3B7BB", -"R c #6C6E71", -"S c #363739", -"T c #191A1B", -"U c #292A2B", -"V c #2D2E2F", -"W c #262728", -" . +@ ", -" #$ %& ", -" #$ %& ", -" #$*=%&- ", -" ;>,')!~{- ", -" -]^/(_:<[}-", -" -|1|234]56-", -" 7890abc6d ", -" -2efghi}j ", -" -2iklmn}j ", -" opqlkmr'o ", -" oasthpu ", -" 7vvvw ", -" xyzA ", -" oBC ", -" o9D ", -"E FGH ", -"aIJJKfLo ", -"MNOPQRS ", -" TUVW "}; - -/* XPM */ -static char * battery_small_xpm[] = { -"12 20 97 2", -" c None", -". c #33312F", -"+ c #3F3C39", -"@ c #36312C", -"# c #221C18", -"$ c #000000", -"% c #615953", -"& c #6B6159", -"* c #A0948A", -"= c #E1D3C7", -"- c #AF9A88", -"; c #6B5646", -"> c #493C31", -", c #493D34", -"' c #35332D", -") c #A69A89", -"! c #B4A293", -"~ c #D0BEB0", -"{ c #BCA797", -"] c #AD9684", -"^ c #896C54", -"/ c #876C56", -"( c #9A826F", -"_ c #9C8472", -": c #958473", -"< c #302C27", -"[ c #2E2C02", -"} c #D0C54D", -"| c #EADF9C", -"1 c #C6B4A6", -"2 c #C9B8AA", -"3 c #CDBCAE", -"4 c #C7B4A5", -"5 c #C5B678", -"6 c #9E903B", -"7 c #1F1C00", -"8 c #CEC314", -"9 c #F0E53A", -"0 c #F5EC8A", -"a c #F1E67E", -"b c #ECE173", -"c c #DED05F", -"d c #D8CA54", -"e c #CBBF4F", -"f c #A79C03", -"g c #897D00", -"h c #FDF65F", -"i c #F9DF46", -"j c #FB5014", -"k c #E5CB25", -"l c #DACE18", -"m c #C6BB0E", -"n c #CEC414", -"o c #FBAB35", -"p c #FB290A", -"q c #EA9C19", -"r c #D9CE18", -"s c #252518", -"t c #BCB540", -"u c #F8EE4A", -"v c #EAA329", -"w c #E3D829", -"x c #837B25", -"y c #1C1B13", -"z c #222222", -"A c #949491", -"B c #B1B0AA", -"C c #EFEA75", -"D c #E9E163", -"E c #E0D754", -"F c #D4CC45", -"G c #CAC235", -"H c #B9B12B", -"I c #7F7F79", -"J c #72716F", -"K c #1B1B1B", -"L c #212121", -"M c #939393", -"N c #AEAEAE", -"O c #C0C0C0", -"P c #B8B8B8", -"Q c #A3A3A3", -"R c #989898", -"S c #8D8D8D", -"T c #7E7E7E", -"U c #717171", -"V c #7D7D7D", -"W c #818181", -"X c #656565", -"Y c #747474", -"Z c #4D4D4D", -"` c #676767", -" . c #636363", -".. c #5E5E5E", -"+. c #585858", -"@. c #525252", -"#. c #4C4C4C", -" ", -" . + @ # ", -" $ % & * = - ; > , $ ", -"' ) ! ~ { ] ^ / ( _ : < ", -"[ } | 1 2 3 4 4 4 5 6 7 ", -"[ 8 9 0 a b c d e f g 7 ", -"[ 8 9 h i j k l m f g 7 ", -"[ n 9 h o p q r m f g 7 ", -"s t 9 h u v w r m f x y ", -"z A B C D E F G H I J K ", -"L M N O P N Q R S T U K ", -"z M N O P N Q R S V U K ", -"L M N O P N Q R S T U K ", -"L M N O P N Q R S T U K ", -"L M N O P N Q R S T U K ", -"L M N O W X Y R S T U K ", -"X M N O P N Q R S T U X ", -" Z S O P N Q R S X X ", -" X ` ...+.@.#.X ", -" "}; - - -/* XPM */ -static char * battery_small_meter_xpm[] = { -"12 20 72 1", -" c None", -". c #33312F", -"+ c #3F3C39", -"@ c #36312C", -"# c #221C18", -"$ c #000000", -"% c #615953", -"& c #6B6159", -"* c #A0948A", -"= c #E1D3C7", -"- c #AF9A88", -"; c #6B5646", -"> c #493C31", -", c #493D34", -"' c #35332D", -") c #AEA291", -"! c #B6A496", -"~ c #D0BEB0", -"{ c #BCA797", -"] c #AD9684", -"^ c #896C54", -"/ c #876C56", -"( c #9A826F", -"_ c #9C8472", -": c #958473", -"< c #302C27", -"[ c #2E2C02", -"} c #ADADAD", -"| c #C2C2C2", -"1 c #C6B4A6", -"2 c #CABAAC", -"3 c #CFBFB2", -"4 c #C7B4A5", -"5 c #C9B8A9", -"6 c #C8B6A7", -"7 c #9D9D9D", -"8 c #1F1C00", -"9 c #939393", -"0 c #AEAEAE", -"a c #C9C9C9", -"b c #CBCBCB", -"c c #C6C6C6", -"d c #C1C1C1", -"e c #B6B6B6", -"f c #A7A7A7", -"g c #878787", -"h c #777777", -"i c #BCBCBC", -"j c #B2B2B2", -"k c #9C9C9C", -"l c #929292", -"m c #7D7D7D", -"n c #717171", -"o c #C0C0C0", -"p c #B8B8B8", -"q c #A3A3A3", -"r c #989898", -"s c #8D8D8D", -"t c #252518", -"u c #1C1B13", -"v c #222222", -"w c #1B1B1B", -"x c #212121", -"y c #7E7E7E", -"z c #656565", -"A c #4D4D4D", -"B c #676767", -"C c #636363", -"D c #5E5E5E", -"E c #585858", -"F c #525252", -"G c #4C4C4C", -" ", -" .+@# ", -" $%&*=-;>,$ ", -"')!~{]^/(_:<", -"[}|123456}78", -"[90abcdefgh8", -"[90|ijfklmn8", -"[90op0qrsmn8", -"t90op0qrsmnu", -"v90op0qrsmnw", -"x90op0qrsmnw", -"v90op0qrsmnw", -"x90op0qrsynw", -"x90op0qrsynw", -"x90op0qrsynw", -"x90op0qrsynw", -"z90op0qrsynz", -" Asop0qrszz ", -" zBCDEFGz ", -" "}; - -/* XPM */ -static char * charge_small_xpm[] = { -"12 20 106 2", -" c None", -". c #515337", -"+ c #A3A669", -"@ c #28291B", -"# c #BFBF40", -"$ c #808000", -"% c #D4D42B", -"& c #404000", -"* c #101111", -"= c #3E3E28", -"- c #4A4C4D", -"; c #424445", -"> c #B9BA53", -", c #747527", -"' c #64676A", -") c #A1A491", -"! c #C9CA52", -"~ c #3A3A14", -"{ c #717578", -"] c #B0B4B7", -"^ c #929353", -"/ c #626465", -"( c #9FA2A6", -"_ c #BDC0AE", -": c #7B7B52", -"< c #515355", -"[ c #A2A6AA", -"} c #868A8E", -"| c #B4B8BB", -"1 c #B5B8B2", -"2 c #C3C7CB", -"3 c #C2C6C6", -"4 c #B0B3B0", -"5 c #8A8E92", -"6 c #6F7275", -"7 c #333435", -"8 c #A3A7AB", -"9 c #BABEC2", -"0 c #B0B4B8", -"a c #B5B9BD", -"b c #AEB2B6", -"c c #6F7172", -"d c #3D3E30", -"e c #131314", -"f c #BEC2C6", -"g c #B8BCC0", -"h c #BBBFC3", -"i c #909295", -"j c #5D5D37", -"k c #494A36", -"l c #3A3C3E", -"m c #C7CBCF", -"n c #DDE1E5", -"o c #A5A8A3", -"p c #7F7F14", -"q c #8B8B37", -"r c #434547", -"s c #000000", -"t c #95999D", -"u c #CFD3D7", -"v c #A1A4A7", -"w c #86870C", -"x c #CDCD2A", -"y c #353625", -"z c #8B8E91", -"A c #7B7C14", -"B c #F2F200", -"C c #99990D", -"D c #626461", -"E c #3D3F41", -"F c #232425", -"G c #585800", -"H c #DFDF15", -"I c #DFDF1B", -"J c #535322", -"K c #1E1E1F", -"L c #525220", -"M c #DFDF1C", -"N c #DDDD15", -"O c #848416", -"P c #2C2C16", -"Q c #363732", -"R c #98980C", -"S c #777702", -"T c #353524", -"U c #828200", -"V c #121212", -"W c #303132", -"X c #8A8A37", -"Y c #76760B", -"Z c #808285", -"` c #434546", -" . c #5C5F61", -".. c #555641", -"+. c #575831", -"@. c #454749", -"#. c #7E8184", -"$. c #C6CACE", -"%. c #CED2D6", -"&. c #A3A7AA", -"*. c #3C3D2E", -"=. c #2A2B2A", -"-. c #191A1B", -";. c #292A2B", -">. c #2D2E2F", -",. c #262728", -" . + @ ", -" # $ % & ", -" # $ % & ", -" # $ * = % & - ", -" ; > , ' ) ! ~ { - ", -" - ] ^ / ( _ : < [ } - ", -" - | 1 | 2 3 4 ] 5 6 - ", -" 7 8 9 0 a b c d e ", -" - 2 f g h i j k l ", -" - 2 m n o p q r r ", -" s t u v w x y ' s ", -" s z A B C D E ", -" F G H I J ", -" K L M N O P ", -" s Q R B S ", -" s T x U ", -"V W X Y ", -"a Z ` ` ...+.s ", -"@.#.$.%.&.*.=. ", -" -.;.>.,. "}; -/* XPM */ -static char * warning_small_xpm[] = { -"6 12 7 1", -" c None", -". c #000000", -"+ c #FF6B6B", -"@ c #E50000", -"# c #FF4C4C", -"$ c #FF0707", -"% c #AA0000", -" .. ", -" .+@. ", -".+#$%.", -".+$$$.", -".+$$$.", -".@$$%.", -" .$$. ", -" .@%. ", -" .. ", -" .+$. ", -" .@%. ", -" .. "}; -/* XPM */ -static char * battery_gray_xpm[] = { -"41 16 34 1", -" c None", -". c #000000", -"+ c #E7DBD0", -"@ c #ABABAB", -"# c #9F9F9F", -"$ c #B4A08F", -"% c #C4C4C4", -"& c #B6B6B6", -"* c #D5C4B6", -"= c #D3D3D3", -"- c #DEDEDE", -"; c #CFCFCF", -"> c #9F8672", -", c #D8D8D8", -"' c #C9C9C9", -") c #D7D7D7", -"! c #D5D5D5", -"~ c #F0E7DF", -"{ c #BFAC9C", -"] c #CDCDCD", -"^ c #BFBFBF", -"/ c #826249", -"( c #C7C7C7", -"_ c #B9B9B9", -": c #76553B", -"< c #C1C1C1", -"[ c #B4B4B4", -"} c #BBBBBB", -"| c #AEAEAE", -"1 c #B5B5B5", -"2 c #A8A8A8", -"3 c #A2A2A2", -"4 c #9C9C9C", -"5 c #979797", -" ................................... ", -" .+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#. ", -" .$+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%. ", -" .*$+===============================%==. ", -" .**$+-----------------------------;----.", -" .>*$+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',)!,.", -".~+>{+=============================%====.", -".+*>{+]]]]]]]]]]]]]]]]]]]]]]]]]]]]]^]]]].", -".*>/{*(((((((((((((((((((((((((((((_((((.", -".>>:{*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<<.", -" .:>{*}}}}}}}}}}}}}}}}}}}}}}}}}}}}}|}}}}.", -" .>>{*1111111111111111111111111111121111.", -" .>>*|||||||||||||||||||||||||||||||3||. ", -" .>*2222222222222222222222222222222422. ", -" .*3333333333333333333333333333333335. ", -" ................................... "}; diff --git a/battstat/properties.c b/battstat/properties.c index f84eea78..fcc84093 100644 --- a/battstat/properties.c +++ b/battstat/properties.c @@ -44,9 +44,6 @@ #include <gio/gio.h> -#include <mate-panel-applet.h> -#include <mate-panel-applet-gsettings.h> - #include "battstat.h" #ifndef gettext_noop @@ -114,54 +111,9 @@ spin_ptr_cb (GtkWidget *spin_ptr, gpointer data) } static void -radio_traditional_toggled (GtkToggleButton *button, gpointer data) -{ - ProgressData *battstat = data; - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); - gboolean toggled; - - toggled = gtk_toggle_button_get_active (button); - - /* if (!( toggled || battstat->showtext || battstat->showstatus)) { - gtk_toggle_button_set_active (button, !toggled); - return; - } */ - - battstat->showbattery = toggled; - reconfigure_layout( battstat ); - - g_settings_set_boolean (battstat->settings, "show-battery", - battstat->showbattery); - -} - -static void -radio_ubuntu_toggled (GtkToggleButton *button, gpointer data) -{ - ProgressData *battstat = data; - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); - gboolean toggled; - - toggled = gtk_toggle_button_get_active (button); - - /* if (!( toggled || battstat->showtext || battstat->showbattery)) { - gtk_toggle_button_set_active (button, !toggled); - return; - } */ - - battstat->showstatus = toggled; - reconfigure_layout( battstat ); - - g_settings_set_boolean (battstat->settings, "show-status", - battstat->showstatus); - -} - -static void show_text_toggled (GtkToggleButton *button, gpointer data) { ProgressData *battstat = data; - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (battstat->radio_text_2)) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (battstat->check_text))) @@ -190,7 +142,6 @@ static void lowbatt_toggled (GtkToggleButton *button, gpointer data) { ProgressData *battstat = data; - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); battstat->lowbattnotification = gtk_toggle_button_get_active (button); g_settings_set_boolean (battstat->settings, "low-battery-notification", @@ -203,7 +154,6 @@ static void full_toggled (GtkToggleButton *button, gpointer data) { ProgressData *battstat = data; - MatePanelApplet *applet = MATE_PANEL_APPLET (battstat->applet); battstat->fullbattnot = gtk_toggle_button_get_active (button); g_settings_set_boolean (battstat->settings, "full-battery-notification", @@ -323,35 +273,6 @@ prop_cb (GtkAction *action, TRUE); } - battstat->radio_traditional_battery = GTK_WIDGET (gtk_builder_get_object (builder, - "battery_view_2")); - g_signal_connect (G_OBJECT (battstat->radio_traditional_battery), "toggled", - G_CALLBACK (radio_traditional_toggled), battstat); - - if (!g_settings_is_writable (battstat->settings, "show-battery")) - hard_set_sensitive (battstat->radio_traditional_battery, FALSE); - - if (battstat->showbattery) - { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (battstat->radio_traditional_battery), - TRUE); - } - - battstat->radio_ubuntu_battery = GTK_WIDGET (gtk_builder_get_object (builder, - "battery_view")); - g_signal_connect (G_OBJECT (battstat->radio_ubuntu_battery), "toggled", - G_CALLBACK (radio_ubuntu_toggled), battstat); - - if (!g_settings_is_writable (battstat->settings, "show-status")) - hard_set_sensitive (battstat->radio_ubuntu_battery, FALSE); - - if (battstat->showstatus) - { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (battstat->radio_ubuntu_battery), TRUE); - } - battstat->radio_text_1 = GTK_WIDGET (gtk_builder_get_object (builder, "show_text_radio")); battstat->radio_text_2 = GTK_WIDGET (gtk_builder_get_object (builder, "show_text_radio_2")); |