diff options
Diffstat (limited to 'multiload')
-rw-r--r-- | multiload/Makefile.am | 8 | ||||
-rw-r--r-- | multiload/global.h | 5 | ||||
-rw-r--r-- | multiload/load-graph.c | 119 | ||||
-rw-r--r-- | multiload/main.c | 3 | ||||
-rw-r--r-- | multiload/netspeed.c | 4 | ||||
-rw-r--r-- | multiload/org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in | 2 | ||||
-rw-r--r-- | multiload/org.mate.panel.applet.MultiLoadAppletFactory.service.in | 2 |
7 files changed, 24 insertions, 119 deletions
diff --git a/multiload/Makefile.am b/multiload/Makefile.am index e6073c5b..43b238e4 100644 --- a/multiload/Makefile.am +++ b/multiload/Makefile.am @@ -8,9 +8,9 @@ AM_CPPFLAGS = \ $(MATEDESKTOP_CFLAGS) \ $(GIO_CFLAGS) -libexec_PROGRAMS = multiload-applet-2 +libexec_PROGRAMS = multiload-applet -multiload_applet_2_SOURCES = \ +multiload_applet_SOURCES = \ global.h \ linux-proc.h \ load-graph.h \ @@ -22,7 +22,7 @@ multiload_applet_2_SOURCES = \ autoscaler.c \ autoscaler.h -multiload_applet_2_LDADD = \ +multiload_applet_LDADD = \ $(MATE_APPLETS4_LIBS) \ $(GTOP_APPLETS_LIBS) \ $(MATEDESKTOP_LIBS) \ @@ -42,7 +42,7 @@ EXTRA_DIST = \ $(gsettings_SCHEMAS).in.in \ $(ui_DATA) -uidir = $(datadir)/mate-2.0/ui +uidir = $(datadir)/mate/ui ui_DATA = multiload-applet-menu.xml appletdir = $(datadir)/mate-panel/applets diff --git a/multiload/global.h b/multiload/global.h index a480f11c..52e25db6 100644 --- a/multiload/global.h +++ b/multiload/global.h @@ -40,12 +40,7 @@ struct _LoadGraph { #endif GtkWidget *main_widget; GtkWidget *frame, *box, *disp; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; -#else - GdkPixmap *pixmap; - GdkGC *gc; -#endif int timer_index; gint show_frame; diff --git a/multiload/load-graph.c b/multiload/load-graph.c index ec14156e..a6508056 100644 --- a/multiload/load-graph.c +++ b/multiload/load-graph.c @@ -50,105 +50,45 @@ load_graph_draw (LoadGraph *g) { GtkStyle *style; guint i, j; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr; -#endif /* we might get called before the configure event so that * g->disp->allocation may not have the correct size * (after the user resized the applet in the prop dialog). */ -#if GTK_CHECK_VERSION (3, 0, 0) if (!g->surface) g->surface = gdk_window_create_similar_surface (gtk_widget_get_window (g->disp), CAIRO_CONTENT_COLOR, g->draw_width, g->draw_height); -#else - if (!g->pixmap) - g->pixmap = gdk_pixmap_new (gtk_widget_get_window (g->disp), - g->draw_width, g->draw_height, - gtk_widget_get_visual (g->disp)->depth); -#endif style = gtk_widget_get_style (g->disp); -#if GTK_CHECK_VERSION (3, 0, 0) cr = cairo_create (g->surface); cairo_set_line_width (cr, 1.0); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); -#else - /* Create GC if necessary. */ - if (!g->gc) - { - g->gc = gdk_gc_new (gtk_widget_get_window (g->disp)); - gdk_gc_copy (g->gc, style->black_gc); - } - - /* Allocate colors. */ - if (!g->colors_allocated) - { - GdkColormap *colormap; - - colormap = gdk_drawable_get_colormap (gtk_widget_get_window (g->disp)); - - for (i = 0; i < g->n; i++) - gdk_colormap_alloc_color (colormap, &(g->colors [i]), - FALSE, TRUE); - - g->colors_allocated = 1; - } - - /* Erase Rectangle */ - gdk_draw_rectangle (g->pixmap, - style->black_gc, - TRUE, 0, 0, - g->draw_width, - g->draw_height); -#endif + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND); for (i = 0; i < g->draw_width; i++) g->pos [i] = g->draw_height - 1; for (j = 0; j < g->n; j++) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_color (cr, &(g->colors [j])); -#else - gdk_gc_set_foreground (g->gc, &(g->colors [j])); -#endif for (i = 0; i < g->draw_width; i++) { if (g->data [i][j] != 0) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_move_to (cr, g->draw_width - i - 0.5, g->pos[i] + 0.5); cairo_line_to (cr, g->draw_width - i - 0.5, g->pos[i] - (g->data [i][j] - 0.5)); -#else - gdk_draw_line (g->pixmap, g->gc, - g->draw_width - i - 1, - g->pos[i], - g->draw_width - i - 1, - g->pos[i] - (g->data [i][j] - 1)); -#endif g->pos [i] -= g->data [i][j]; } } -#if GTK_CHECK_VERSION (3, 0, 0) cairo_stroke (cr); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (g->disp); -#else - gdk_draw_drawable (gtk_widget_get_window (g->disp), - style->fg_gc [gtk_widget_get_state (g->disp)], - g->pixmap, - 0, 0, - 0, 0, - g->draw_width, - g->draw_height); -#endif + + cairo_destroy (cr); } /* Updates the load graph when the timeout expires */ @@ -191,22 +131,10 @@ load_graph_unalloc (LoadGraph *g) g->size = g_settings_get_int(g->multiload->settings, "size"); g->size = MAX (g->size, 10); -#if GTK_CHECK_VERSION (3, 0, 0) if (g->surface) { cairo_surface_destroy (g->surface); g->surface = NULL; } -#else - if (g->pixmap) { - g_object_unref (g->pixmap); - g->pixmap = NULL; - } - - if (g->gc) { - g_object_unref (g->gc); - g->gc = NULL; - } -#endif g->allocated = FALSE; } @@ -249,32 +177,11 @@ load_graph_configure (GtkWidget *widget, GdkEventConfigure *event, load_graph_alloc (c); -#if GTK_CHECK_VERSION (3, 0, 0) if (!c->surface) c->surface = gdk_window_create_similar_surface (gtk_widget_get_window (c->disp), CAIRO_CONTENT_COLOR, c->draw_width, c->draw_height); gtk_widget_queue_draw (widget); -#else - if (!c->pixmap) - c->pixmap = gdk_pixmap_new (gtk_widget_get_window (c->disp), - c->draw_width, - c->draw_height, - gtk_widget_get_visual (c->disp)->depth); - - gdk_draw_rectangle (c->pixmap, - (gtk_widget_get_style (widget))->black_gc, - TRUE, 0,0, - c->draw_width, - c->draw_height); - gdk_draw_drawable (gtk_widget_get_window (widget), - (gtk_widget_get_style (c->disp))->fg_gc [gtk_widget_get_state (widget)], - c->pixmap, - 0, 0, - 0, 0, - c->draw_width, - c->draw_height); -#endif return TRUE; } @@ -290,16 +197,18 @@ load_graph_expose (GtkWidget *widget, { LoadGraph *g = (LoadGraph *) data_ptr; -#if GTK_CHECK_VERSION (3, 0, 0) +#if !GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr; + cr = gdk_cairo_create (event->window); + gdk_cairo_region (cr, event->region); + cairo_clip (cr); +#endif + cairo_set_source_surface (cr, g->surface, 0, 0); cairo_paint (cr); -#else - gdk_draw_drawable (gtk_widget_get_window (widget), - (gtk_widget_get_style (widget))->fg_gc [gtk_widget_get_state (widget)], - g->pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + +#if !GTK_CHECK_VERSION (3, 0, 0) + cairo_destroy (cr); #endif return FALSE; diff --git a/multiload/main.c b/multiload/main.c index 6efa2e31..b8e065bb 100644 --- a/multiload/main.c +++ b/multiload/main.c @@ -30,6 +30,7 @@ #include <mate-panel-applet.h> #include <mate-panel-applet-gsettings.h> +#include <libmate-desktop/mate-aboutdialog.h> #if GTK_CHECK_VERSION (3, 0, 0) #define MATE_DESKTOP_USE_UNSTABLE_API #include <libmate-desktop/mate-desktop-utils.h> @@ -58,7 +59,7 @@ about_cb (GtkAction *action, NULL }; - gtk_show_about_dialog (NULL, + mate_show_about_dialog (NULL, "version", VERSION, "copyright", "\xC2\xA9 1999-2005 Free Software Foundation " "and others", diff --git a/multiload/netspeed.c b/multiload/netspeed.c index 0b816719..7d46ec7a 100644 --- a/multiload/netspeed.c +++ b/multiload/netspeed.c @@ -31,12 +31,12 @@ void netspeed_add(NetSpeed *ns, gulong tx) ns->states[ns->cur] = tx; } -/* Something very similar to g_format_size_for_display() but for rates. +/* Something very similar to g_format_size() but for rates. * This should give the same display as in g-s-m */ static char* format_rate_for_display(guint rate) { - char* bytes = g_format_size_for_display(rate); + char* bytes = g_format_size(rate); return g_strdup_printf(_("%s/s"), bytes); } diff --git a/multiload/org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in b/multiload/org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in index f62ca12b..584b0c03 100644 --- a/multiload/org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in +++ b/multiload/org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in @@ -1,6 +1,6 @@ [Applet Factory] Id=MultiLoadAppletFactory -Location=@LIBEXECDIR@/multiload-applet-2 +Location=@LIBEXECDIR@/multiload-applet Name=MultiLoad Applet Factory Description=Factory for creating the load applet. diff --git a/multiload/org.mate.panel.applet.MultiLoadAppletFactory.service.in b/multiload/org.mate.panel.applet.MultiLoadAppletFactory.service.in index 8c37aecd..f592f048 100644 --- a/multiload/org.mate.panel.applet.MultiLoadAppletFactory.service.in +++ b/multiload/org.mate.panel.applet.MultiLoadAppletFactory.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.mate.panel.applet.MultiLoadAppletFactory -Exec=@LIBEXECDIR@/multiload-applet-2 +Exec=@LIBEXECDIR@/multiload-applet |