Changeset 51

Show
Ignore:
Timestamp:
04/24/07 12:55:17 (2 years ago)
Author:
inz
Message:

First version for bora.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • osso-statusbar-cpu/trunk/Makefile.am

    r3 r51  
    2828schemasdir=/etc/gconf/schemas 
    2929schemas_DATA=osso-statusbar-cpu.schemas 
     30 
     31hildonstatusbardesktop_DATA=osso-statusbar-cpu.desktop 
  • osso-statusbar-cpu/trunk/configure.ac

    r3 r51  
    22 
    33# Mandatory, inits autoconf 
    4 AC_INIT(osso-statusbar-cpu, 0.5.7
     4AC_INIT(osso-statusbar-cpu, 0.6.0
    55 
    66# Tests that source dir exists 
     
    4040#return the flag 
    4141#CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wmissing-prototypes -Wmissing-declarations -Werror -Wunreachable-code -Wcast-align -std=c99" 
    42 CFLAGS="$CFLAGS -Wall -ansi  -Wmissing-prototypes -Wmissing-declarations -Werror" 
     42CFLAGS="$CFLAGS -D_POSIX_SOURCE -W -Wall -ansi  -Wmissing-prototypes -Wmissing-declarations -Werror" 
    4343AC_SUBST(CFLAGS) 
    4444                                                                                 
     
    6868AC_SUBST(hildonstatusbarplugindir) 
    6969 
     70hildonstatusbardesktopdir=/usr/share/applications/hildon-status-bar 
     71AC_SUBST(hildonstatusbardesktopdir) 
     72 
    7073hildoncontrolpanelappletdir=`pkg-config hildon-control-panel --variable=pluginlibdir` 
    7174AC_SUBST(hildoncontrolpanelappletdir) 
  • osso-statusbar-cpu/trunk/debian/changelog

    r3 r51  
     1osso-statusbar-cpu (0.6.0) mistral; urgency=low 
     2 
     3  * First version for bora. 
     4 
     5 -- Santtu Lakkala <inz@inz.fi>  Tue, 24 Apr 2007 11:31:49 +0300 
     6 
    17osso-statusbar-cpu (0.5.7) mistral; urgency=low 
    28 
  • osso-statusbar-cpu/trunk/debian/rules

    r3 r51  
    8888#       dh_installpam 
    8989#       dh_installmime 
    90       dh_gconf 
     90#     dh_gconf 
    9191        dh_installinit -- defaults 60 40 
    9292#       dh_installcron 
  • osso-statusbar-cpu/trunk/osso-statusbar-cpu.schemas

    r3 r51  
    77      <owner>osso-statusbar-cpu</owner> 
    88      <type>bool</type> 
    9       <default>false</default> 
     9      <default>true</default> 
    1010      <locale name="C"> 
    1111        <short>Show CPU applet</short> 
     
    2727      <owner>osso-statusbar-cpu</owner> 
    2828      <type>bool</type> 
    29       <default>false</default> 
     29      <default>true</default> 
    3030      <locale name="C"> 
    3131        <short>Show MEM applet</short> 
     
    4040      <locale name="C"> 
    4141        <short>Colour of mem graph</short> 
    42       </locale> 
    43     </schema> 
    44     <schema> 
    45       <key>/schemas/apps/osso/graph/combo_on</key> 
    46       <applyto>/apps/osso/graph/combo_on</applyto> 
    47       <owner>osso-statusbar-cpu</owner> 
    48       <type>bool</type> 
    49       <default>true</default> 
    50       <locale name="C"> 
    51         <short>Show combo applet</short> 
    5242      </locale> 
    5343    </schema> 
  • osso-statusbar-cpu/trunk/src/Makefile.am

    r3 r51  
    44AM_LDFLAGS = -module -avoid-version 
    55 
    6 hildonstatusbarplugin_LTLIBRARIES =  libcpu.la libmem.la libcombo.la 
     6hildonstatusbarplugin_LTLIBRARIES =  libcombo.la 
    77hildoncontrolpanelapplet_LTLIBRARIES = libgraph.la 
    88hildoncontrolpaneldesktop_DATA = cpgraph.desktop 
    99 
    10 libcpu_la_LIBADD = $(DEPS_LIBS) 
    11 libmem_la_LIBADD = $(DEPS_LIBS) 
    1210libcombo_la_LIBADD = $(DEPS_LIBS) 
    1311libgraph_la_LIBADD = $(DEPS_LIBS) 
    1412 
    15 libcpu_la_SOURCES = osso-statusbar-cpu.c osso-statusbar-cpu.h \ 
    16                     common.c dialog.c dialog.h common.h 
    17 libmem_la_SOURCES = osso-statusbar-mem.c osso-statusbar-mem.h \ 
    18                     common.c dialog.c dialog.h common.h 
    1913libcombo_la_SOURCES = osso-statusbar-combo.c osso-statusbar-combo.h \ 
    2014                    common.c dialog.c dialog.h common.h 
  • osso-statusbar-cpu/trunk/src/common.c

    r3 r51  
    1515                   guchar r, guchar g, guchar b, guint xx, guint w) 
    1616{ 
    17         int x, y; 
    18         int width, height, rowstride, n_channels; 
     17        guint x, y; 
     18        guint width, height, rowstride, n_channels; 
    1919        guchar *pixels, *p, *p0; 
    2020 
     
    101101 
    102102void popup_place(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { 
     103        GtkRequisition req; 
    103104        GtkWidget *btn = GTK_WIDGET(user_data); 
     105        gint sw; 
     106 
     107        (void)push_in; 
     108 
     109        gtk_widget_size_request(GTK_WIDGET(menu), &req); 
     110        sw = gdk_screen_get_width(gtk_widget_get_screen(btn)); 
    104111 
    105112        gdk_window_get_position(btn->window, x, y); 
     
    107114        *y += btn->allocation.y + btn->allocation.height; 
    108115        *x += btn->allocation.x; 
     116 
     117        if (*x + req.width > sw) { 
     118                *x -= req.width - btn->allocation.width; 
     119        } 
    109120} 
    110121 
     
    170181        GtkWidget *entry; 
    171182 
     183        (void)item; 
     184        (void)user_data; 
     185 
    172186        dialog = gtk_dialog_new_with_buttons("Run command", 
    173187                        NULL, 
     
    265279static void run_settings(GtkMenuItem *item, gpointer user_data) 
    266280{ 
     281        (void)item; 
    267282        osso_cp_plugin_execute((osso_context_t *)user_data, "libgraph.so", NULL, TRUE); 
    268283} 
  • osso-statusbar-cpu/trunk/src/osso-applet-graph.c

    r3 r51  
    4343        GraphApplet applet; 
    4444        gint response = GRAPH_RESPONSE_COMMANDS; 
    45  
    46 /*      (void) bindtextdomain(PACKAGE, LOCALEDIR); */ 
     45         
     46        (void)user_activated; 
    4747 
    4848        /* Create the main dialog and refresh the ui */ 
     
    6969                gconf_client_set_bool(applet.gcc, GCONF_PATH_CLOCK_ON, 
    7070                                applet.flags & CLOCK ? TRUE : FALSE, NULL); 
    71                 if (applet.flags & COMBO) { 
    72                         gconf_client_set_bool(applet.gcc, GCONF_PATH_CPU_ON, 
    73                                         FALSE, NULL); 
    74                         gconf_client_set_bool(applet.gcc, GCONF_PATH_MEM_ON, 
    75                                         FALSE, NULL); 
    76                         gconf_client_set_bool(applet.gcc, GCONF_PATH_COMBO_ON, 
    77                                         TRUE, NULL); 
    78                         osso_statusbar_send_event(applet.osso, "cpu", 
    79                                         1, 0, "", NULL); 
    80                         osso_statusbar_send_event(applet.osso, "mem", 
    81                                         1, 0, "", NULL); 
    82                         osso_statusbar_send_event(applet.osso, "combo", 
    83                                         1, 1, "", NULL); 
    84                 } else { 
    85                         gconf_client_set_bool(applet.gcc, GCONF_PATH_COMBO_ON, 
    86                                         FALSE, 
    87                                         NULL); 
    88                         gconf_client_set_bool(applet.gcc, GCONF_PATH_CPU_ON, 
    89                                         (applet.flags & CPU_ON ? TRUE : FALSE), 
    90                                         NULL); 
    91                         gconf_client_set_bool(applet.gcc, GCONF_PATH_MEM_ON, 
    92                                         (applet.flags & MEM_ON ? TRUE : FALSE), 
    93                                         NULL); 
    94                         osso_statusbar_send_event(applet.osso, "cpu", 
    95                                         1, (applet.flags & CPU_ON ? 1 : 0), 
    96                                         "", NULL); 
    97                         osso_statusbar_send_event(applet.osso, "mem", 
    98                                         1, (applet.flags & MEM_ON ? 1 : 0), 
    99                                         "", NULL); 
    100                         osso_statusbar_send_event(applet.osso, "combo", 
    101                                         1, 0, "", NULL); 
    102                 } 
     71                gconf_client_set_bool(applet.gcc, GCONF_PATH_CPU_ON, 
     72                                applet.flags & CPU_ON ? TRUE : FALSE, NULL); 
     73                gconf_client_set_bool(applet.gcc, GCONF_PATH_MEM_ON, 
     74                                applet.flags & MEM_ON ? TRUE : FALSE, NULL); 
    10375                gconf_client_set_int(applet.gcc, GCONF_PATH_CPU_COLOR, 
    10476                                applet.cpu_color, NULL); 
     
    10779                update_cmds(gtk_tree_view_get_model(GTK_TREE_VIEW(applet.commands_list)), 
    10880                                applet.gcc); 
     81                gconf_client_unset(applet.gcc, GCONF_PATH_COMBO_ON, NULL); 
    10982        } 
    11083 
     
    185158                        NULL); 
    186159 
    187         if (b_combine) { 
    188                 b_show_cpu = TRUE; 
    189                 b_show_mem = TRUE; 
    190         } 
    191         applet->flags = b_combine * COMBO | 
    192                 b_show_cpu * CPU_ON | 
    193                 b_show_mem * MEM_ON | 
    194                 b_clock * CLOCK; 
     160        g_debug("cb: %d, cp: %d, me: %d", b_combine, b_show_cpu, b_show_mem); 
     161        if (b_combine || (b_show_cpu && b_show_mem)) { 
     162                b_show_cpu = FALSE; 
     163                b_show_mem = FALSE; 
     164                applet->flags = CPU_ON | MEM_ON | b_clock * CLOCK; 
     165        } else { 
     166                applet->flags = b_show_cpu * CPU_ON | 
     167                        b_show_mem * MEM_ON | 
     168                        b_clock * CLOCK; 
     169        } 
     170        g_debug("cb: %d, cp: %d, me: %d", b_combine, b_show_cpu, b_show_mem); 
    195171 
    196172        applet->dialog = 
     
    212188        size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 
    213189 
    214         show_cpu = gtk_check_button_new(); 
    215  
    216         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_cpu), 
    217                                      b_show_cpu); 
     190        show_cpu = gtk_radio_button_new(NULL); 
    218191 
    219192        cpu_caption = hildon_caption_new(size_group, _("Show CPU usage"), 
     
    237210                               applet); 
    238211 
    239         show_mem = gtk_check_button_new(); 
    240  
    241         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_mem), 
    242                                      b_show_mem); 
     212        show_mem = gtk_radio_button_new(gtk_radio_button_get_group( 
     213                                GTK_RADIO_BUTTON(show_cpu))); 
    243214 
    244215        mem_caption = hildon_caption_new(size_group, _("Show mem usage"), 
     
    277248                ); 
    278249 
    279         applet->combo_check = gtk_check_button_new(); 
    280         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(applet->combo_check), 
    281                                      b_combine); 
     250        applet->combo_check = gtk_radio_button_new(gtk_radio_button_get_group( 
     251                                GTK_RADIO_BUTTON(show_cpu))); 
     252 
     253        if (b_show_mem) { 
     254                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_mem), 
     255                                TRUE); 
     256        } else if (b_show_cpu) { 
     257                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_cpu), 
     258                                TRUE); 
     259        } else { 
     260                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(applet->combo_check), 
     261                                TRUE); 
     262        } 
    282263        applet->combo_caption = hildon_caption_new(size_group, 
    283                         _("Combine graphs"), applet->combo_check, NULL, 
     264                        _("Both"), applet->combo_check, NULL, 
    284265                        HILDON_CAPTION_OPTIONAL); 
    285266 
     
    290271                        _("Show clock"), applet->clock_check, NULL, 
    291272                        HILDON_CAPTION_OPTIONAL); 
    292  
    293         gtk_widget_set_sensitive(applet->combo_caption, 
    294                                  b_show_cpu && b_show_mem); 
    295         gtk_widget_set_sensitive(applet->clock_caption, 
    296                                  b_show_cpu || b_show_mem); 
    297273 
    298274        g_signal_connect_after(G_OBJECT(applet->combo_check), 
     
    375351osso_return_t save_state(osso_context_t * osso, gpointer data) 
    376352{ 
     353        (void)osso; 
     354        (void)data; 
    377355        return OSSO_OK; 
    378356} 
     
    386364static void show_cpu_toggled(GtkWidget *widget, GraphApplet *applet) 
    387365{ 
    388         applet->flags &= ~CPU_ON; 
    389         applet->flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) * CPU_ON; 
    390         gconf_client_clear_cache(applet->gcc); 
    391         while (gtk_events_pending()) 
    392                 gtk_main_iteration(); 
    393         if (applet->flags & (CPU_ON | MEM_ON)) { 
    394                 gtk_widget_set_sensitive(applet->clock_caption, TRUE); 
    395         } 
    396         else { 
    397                 gtk_widget_set_sensitive(applet->clock_caption, FALSE); 
    398         } 
    399         if ((applet->flags & (CPU_ON | MEM_ON)) == (CPU_ON | MEM_ON)) { 
    400                 gtk_widget_set_sensitive(applet->combo_caption, TRUE); 
    401         } else { 
    402                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(applet->combo_check), FALSE); 
    403                 gtk_widget_set_sensitive(applet->combo_caption, FALSE); 
     366        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { 
     367                applet->flags &= ~MEM_ON; 
     368                applet->flags |= CPU_ON; 
    404369        } 
    405370} 
     
    407372static void show_mem_toggled(GtkWidget *widget, GraphApplet *applet) 
    408373{ 
    409         applet->flags &= ~MEM_ON; 
    410         applet->flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) * MEM_ON; 
    411         gconf_client_clear_cache(applet->gcc); 
    412         while (gtk_events_pending()) 
    413                 gtk_main_iteration(); 
    414         if (applet->flags & (CPU_ON | MEM_ON)) { 
    415                 gtk_widget_set_sensitive(applet->clock_caption, TRUE); 
    416         } 
    417         else { 
    418                 gtk_widget_set_sensitive(applet->clock_caption, FALSE); 
    419         } 
    420         if ((applet->flags & (CPU_ON | MEM_ON)) == (CPU_ON | MEM_ON)) { 
    421                 gtk_widget_set_sensitive(applet->combo_caption, TRUE); 
    422         } else { 
    423                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(applet->combo_check), FALSE); 
    424                 gtk_widget_set_sensitive(applet->combo_caption, FALSE); 
     374        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { 
     375                applet->flags &= ~CPU_ON; 
     376                applet->flags |= MEM_ON; 
    425377        } 
    426378} 
     
    428380static void combo_toggled(GtkWidget *widget, GraphApplet *applet) 
    429381{ 
    430         applet->flags &= ~COMBO; 
    431         applet->flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) * COMBO; 
    432         gconf_client_clear_cache(applet->gcc); 
    433         while (gtk_events_pending()) 
    434                 gtk_main_iteration(); 
     382        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { 
     383                applet->flags |= MEM_ON | CPU_ON; 
     384        } 
    435385} 
    436386 
     
    617567        GtkTreeModel *model; 
    618568 
     569        (void)button; 
     570 
    619571        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(applet->commands_list)); 
    620572 
     
    639591        GtkTreeModel *model; 
    640592 
     593        (void)button; 
     594 
    641595        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(applet->commands_list)); 
    642596 
  • osso-statusbar-cpu/trunk/src/osso-statusbar-combo.c

    r3 r51  
    3535 
    3636static gboolean my_timeout(gpointer data); 
     37static void cpuon_gconf_handler(GConfClient *gcc, 
     38                                guint con, 
     39                                GConfEntry *entry, gpointer user_data); 
     40static void memon_gconf_handler(GConfClient *gcc, 
     41                                guint con, 
     42                                GConfEntry *entry, gpointer user_data); 
    3743static void my_gconf_handler(GConfClient * gcc, 
    3844                             guint conn, 
     
    99105        info->icon = gtk_image_new_from_pixbuf(icon_pixbuf); 
    100106 
     107        info->show_cpu = gconf_client_get_bool(info->gcc, 
     108                        GCONF_PATH_CPU_ON, NULL); 
     109        info->show_mem = gconf_client_get_bool(info->gcc, 
     110                        GCONF_PATH_MEM_ON, NULL); 
     111 
    101112        info->color_cpu = gc_get_int_fall(info->gcc, 
    102113                                      GCONF_PATH_CPU_COLOR, CPU_DEFAULT); 
     
    114125        *button = info->button; 
    115126 
    116         info->notify_id = g_timeout_add(2000, my_timeout, info); 
     127        info->notify_id = 0; 
     128        if (info->show_cpu || info->show_mem) { 
     129                info->notify_id = g_timeout_add(2000, my_timeout, info); 
     130        } 
    117131 
    118132        gconf_client_add_dir(info->gcc, 
    119133                             GCONF_PATH, GCONF_CLIENT_PRELOAD_NONE, NULL); 
     134 
     135        info->gc_notify_id_scpu = gconf_client_notify_add(info->gcc, 
     136                        GCONF_PATH_CPU_ON, 
     137                        cpuon_gconf_handler, 
     138                        info, NULL, NULL); 
     139 
     140        info->gc_notify_id_smem = gconf_client_notify_add(info->gcc, 
     141                        GCONF_PATH_MEM_ON, 
     142                        memon_gconf_handler, 
     143                        info, NULL, NULL); 
    120144 
    121145        info->gc_notify_id_cpu = gconf_client_notify_add(info->gcc, 
     
    143167 
    144168        gconf_client_clear_cache(info->gcc); 
    145         if (!gconf_client_get_bool(info->gcc, GCONF_PATH_COMBO_ON, NULL)) { 
    146                 gtk_object_destroy(GTK_OBJECT(item)); 
    147         } else { 
    148                 gtk_widget_show_all(info->button); 
    149         } 
     169        gtk_widget_show_all(info->button); 
    150170 
    151171        return info; 
     
    163183        info->notify_id = 0; 
    164184 
     185        gconf_client_notify_remove(info->gcc, info->gc_notify_id_scpu); 
     186        gconf_client_notify_remove(info->gcc, info->gc_notify_id_smem); 
    165187        gconf_client_notify_remove(info->gcc, info->gc_notify_id_cpu); 
    166188        gconf_client_notify_remove(info->gcc, info->gc_notify_id_mem); 
     
    178200gint combo_get_priority(void *data) 
    179201{ 
     202        (void)data; 
    180203        return HILDON_STATUS_BAR_CPU_PRIORITY; 
    181204} 
     
    185208        PluginInfo *info = (PluginInfo *)data; 
    186209        g_return_if_fail(info); 
     210 
     211        (void)value1; 
     212        (void)str; 
    187213 
    188214        if (value2 == 0) 
     
    197223        GdkPixbuf *buf = gtk_image_get_pixbuf(image); 
    198224 
    199         FILE *foo = fopen("/proc/stat", "r"); 
    200         int user, nice, kern, idle, total_change; 
     225        int user, nice, kern, idle, total_change = 0; 
    201226        static int old_user, old_nice, old_kern, old_idle; 
    202         int muser, mnice, mkern, midle; 
    203         fscanf(foo, "cpu %d %d %d %d", &user, &nice, &kern, &idle); 
    204         fclose(foo); 
    205         foo = fopen("/proc/meminfo", "r"); 
    206         fscanf(foo, 
    207                "MemTotal: %d kB MemFree: %d kB Buffers: %d kB Cached: %d kB", 
    208                &muser, &mnice, &mkern, &midle); 
    209         fclose(foo); 
    210  
    211         total_change = user + nice + kern + idle - 
    212                 (old_user + old_nice + old_kern + old_idle); 
    213  
    214         move_left_and_draw(buf, 
    215                            (user - old_user) * AREA_H / (total_change), 
    216                            (nice - old_nice) * AREA_H / (total_change), 
    217                            (kern - old_kern) * AREA_H / (total_change), 
    218                            (info->color_cpu >> 16) & 0xff, 
    219                            (info->color_cpu >> 8) & 0xff, 
    220                            info->color_cpu & 0xff, 
    221                            AREA_X, AREA_W / 2); 
    222         move_left_and_draw(buf, 
    223                            (muser - mnice - mkern - midle) * AREA_H / muser, 
    224                            mkern * AREA_H / muser, 
    225                            midle * AREA_H / muser, 
    226                            (info->color_mem >> 16) & 0xff, 
    227                            (info->color_mem >> 8) & 0xff, 
    228                            info->color_mem & 0xff, 
    229                            AREA_X + AREA_W / 2, (AREA_W + 1) / 2); 
     227        int muser, mnice, mkern, midle, mused = 0; 
     228        int w = (info->show_cpu && info->show_mem) ? AREA_W : AREA_W * 2; 
     229        int x = info->show_cpu ? AREA_X + AREA_W / 2 : AREA_X; 
     230         
     231        if (info->show_cpu) { 
     232                FILE *foo = fopen("/proc/stat", "r"); 
     233                fscanf(foo, "cpu %d %d %d %d", &user, &nice, &kern, &idle); 
     234                fclose(foo); 
     235                total_change = user + nice + kern + idle - 
     236                        (old_user + old_nice + old_kern + old_idle); 
     237        } 
     238        if (info->show_mem) { 
     239                FILE *foo = fopen("/proc/meminfo", "r"); 
     240                fscanf(foo, 
     241                                "MemTotal: %d kB MemFree: %d kB " 
     242                                "Buffers: %d kB Cached: %d kB", 
     243                                &muser, &mnice, &mkern, &midle); 
     244                fclose(foo); 
     245                mused = muser - mnice - mkern - midle; 
     246        } 
     247 
     248        if (info->show_cpu) 
     249                move_left_and_draw(buf, 
     250                                (user - old_user) * AREA_H / (total_change), 
     251                                (nice - old_nice) * AREA_H / (total_change), 
     252                                (kern - old_kern) * AREA_H / (total_change), 
     253                                (info->color_cpu >> 16) & 0xff, 
     254                                (info->color_cpu >> 8) & 0xff, 
     255                                info->color_cpu & 0xff, 
     256                                AREA_X, w / 2); 
     257        if (info->show_mem) 
     258                move_left_and_draw(buf, 
     259                                mused * AREA_H / muser, 
     260                                mkern * AREA_H / muser, 
     261                                midle * AREA_H / muser, 
     262                                (info->color_mem >> 16) & 0xff, 
     263                                (info->color_mem >> 8) & 0xff, 
     264                                info->color_mem & 0xff, 
     265                                x, (w + 1) / 2); 
    230266 
    231267        gtk_image_set_from_pixbuf(image, buf); 
    232268 
    233         old_user = user; 
    234         old_nice = nice; 
    235         old_kern = kern; 
    236         old_idle = idle; 
     269        if (info->show_cpu) { 
     270                old_user = user; 
     271                old_nice = nice; 
     272                old_kern = kern; 
     273                old_idle = idle; 
     274        } 
    237275 
    238276        return TRUE; 
     277} 
     278 
     279static void cpuon_gconf_handler(GConfClient *gcc, 
     280                                guint con, 
     281                                GConfEntry *entry, gpointer user_data) 
     282{ 
     283        PluginInfo *info = user_data; 
     284 
     285        (void)gcc; 
     286        (void)con; 
     287 
     288        info->show_cpu = gconf_value_get_bool(entry->value); 
     289         
     290        if (info->show_cpu) { 
     291                if (!info->notify_id) { 
     292                        info->notify_id = 
     293                                g_timeout_add(2000, my_timeout, user_data); 
     294                } 
     295        } else if (!info->show_mem && info->notify_id) { 
     296                g_source_remove(info->notify_id); 
     297                info->notify_id = 0; 
     298        } 
     299} 
     300 
     301static void memon_gconf_handler(GConfClient *gcc, 
     302                                guint con, 
     303                                GConfEntry *entry, gpointer user_data) 
     304{ 
     305        PluginInfo *info = user_data; 
     306 
     307        (void)gcc; 
     308        (void)con; 
     309 
     310        info->show_mem = gconf_value_get_bool(entry->value); 
     311 
     312         
     313        if (info->show_mem) { 
     314                if (!info->notify_id) { 
     315                        info->notify_id = 
     316                                g_timeout_add(2000, my_timeout, user_data); 
     317                } 
     318        } else if (!info->show_cpu && info->notify_id) { 
     319                g_source_remove(info->notify_id); 
     320                info->notify_id = 0; 
     321        } 
    239322} 
    240323 
     
    243326{ 
    244327        PluginInfo *info = (PluginInfo *)data; 
     328 
     329        (void)gcc; 
     330        (void)conn; 
    245331 
    246332        if (strcmp(entry->key, GCONF_PATH_CPU_COLOR) == 0) { 
     
    257343{ 
    258344        PluginInfo *info = (PluginInfo *)data; 
     345 
     346        (void)gcc; 
     347        (void)conn; 
    259348 
    260349        info->clock = gconf_value_get_bool(gconf_entry_get_value(entry) 
  • osso-statusbar-cpu/trunk/src/osso-statusbar-combo.h

    r3 r51  
    1818        osso_context_t *osso; 
    1919        guint notify_id; 
     20        guint gc_notify_id_scpu; 
     21        guint gc_notify_id_smem; 
    2022        guint gc_notify_id_cpu; 
    2123        guint gc_notify_id_mem; 
     
    2527        gboolean clock; 
    2628        gulong clock_id; 
     29        gboolean show_cpu; 
     30        gboolean show_mem; 
    2731} PluginInfo; 
    2832