Simplify 'cpufreq' plugin using lxpanel_button_new_for_icon().
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 02:49:35 +0000 (04:49 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 22 Nov 2014 02:49:35 +0000 (04:49 +0200)
plugins/cpufreq/cpufreq.c

index b7db457..c61f137 100644 (file)
@@ -46,7 +46,6 @@
 typedef struct {
     GtkWidget *main;
     config_setting_t *settings;
-    GtkWidget *namew;
     GList *governors;
     GList *cpus;
     int has_cpufreq;
@@ -349,14 +348,10 @@ static GtkWidget *cpufreq_constructor(LXPanel *panel, config_setting_t *settings
     cf->cpus = NULL;
     cf->settings = settings;
 
-    cf->main = gtk_event_box_new();
+    cf->main = lxpanel_button_new_for_icon(panel, PROC_ICON, NULL, NULL);
     lxpanel_plugin_set_data(cf->main, cf, cpufreq_destructor);
-    gtk_widget_set_has_window(cf->main, FALSE);
     gtk_container_set_border_width(GTK_CONTAINER(cf->main), 2);
 
-    cf->namew = lxpanel_image_new_for_icon(panel, PROC_ICON, -1, NULL);
-    gtk_container_add(GTK_CONTAINER(cf->main), cf->namew);
-
     cf->has_cpufreq = 0;
 
     get_cpus(cf);
@@ -368,8 +363,6 @@ static GtkWidget *cpufreq_constructor(LXPanel *panel, config_setting_t *settings
     _update_tooltip(cf);
     cf->timer = g_timeout_add_seconds(2, update_tooltip, (gpointer)cf);
 
-    gtk_widget_show(cf->namew);
-
     RET(cf->main);
 }