[gnome-applets/wip/muktupavels/multiload] multiload: port to libgnome-panel
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/muktupavels/multiload] multiload: port to libgnome-panel
- Date: Tue, 31 Mar 2020 14:30:39 +0000 (UTC)
commit 5ab7647bb3d4ca0a43f8ecef87a5eb84de38162f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Mar 31 17:29:58 2020 +0300
multiload: port to libgnome-panel
Makefile.am | 2 -
configure.ac | 4 +-
gnome-applets/Makefile.am | 3 +
gnome-applets/ga-module.c | 11 ++
.../src => gnome-applets/multiload}/Makefile.am | 16 +-
.../src => gnome-applets/multiload}/autoscaler.c | 0
.../src => gnome-applets/multiload}/autoscaler.h | 0
.../src => gnome-applets/multiload}/global.h | 11 +-
.../src => gnome-applets/multiload}/linux-proc.c | 0
.../src => gnome-applets/multiload}/linux-proc.h | 0
.../src => gnome-applets/multiload}/load-graph.c | 14 +-
.../src => gnome-applets/multiload}/load-graph.h | 0
gnome-applets/multiload/multiload-applet-menu.xml | 24 +++
.../multiload/multiload-applet.c | 216 ++++++++++-----------
gnome-applets/multiload/multiload-applet.h | 31 +++
.../src => gnome-applets/multiload}/netspeed.c | 0
.../src => gnome-applets/multiload}/netspeed.h | 0
.../src => gnome-applets/multiload}/properties.c | 21 +-
.../src => gnome-applets/multiload}/properties.h | 0
multiload/Makefile.am | 30 ---
multiload/multiload-applet-menu.xml | 20 --
...nome.applets.MultiLoadApplet.panel-applet.in.in | 15 --
po/POTFILES.in | 11 +-
po/POTFILES.skip | 1 -
24 files changed, 196 insertions(+), 234 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 142b887a9..318f697a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,6 @@
NULL =
always_built_SUBDIRS = \
- multiload \
window-buttons \
$(NULL)
@@ -18,7 +17,6 @@ DIST_SUBDIRS = \
gnome-applets \
help \
po \
- multiload \
window-buttons \
$(NULL)
diff --git a/configure.ac b/configure.ac
index 59a038d3d..98dd416f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -356,6 +356,7 @@ AC_CONFIG_FILES([
gnome-applets/gweather/Makefile
gnome-applets/inhibit/Makefile
gnome-applets/mini-commander/Makefile
+ gnome-applets/multiload/Makefile
gnome-applets/netspeed/Makefile
gnome-applets/sticky-notes/Makefile
gnome-applets/timer/Makefile
@@ -380,9 +381,6 @@ AC_CONFIG_FILES([
po/Makefile.in
- multiload/Makefile
- multiload/src/Makefile
-
window-buttons/Makefile
window-buttons/themes/Makefile
])
diff --git a/gnome-applets/Makefile.am b/gnome-applets/Makefile.am
index ba2ad1b30..c98e785f5 100644
--- a/gnome-applets/Makefile.am
+++ b/gnome-applets/Makefile.am
@@ -12,6 +12,7 @@ SUBDIRS = \
gweather \
inhibit \
mini-commander \
+ multiload \
netspeed \
sticky-notes \
timer \
@@ -53,6 +54,7 @@ org_gnome_gnome_applets_la_LIBADD = \
$(top_builddir)/gnome-applets/gweather/libgweather-applet.la \
$(top_builddir)/gnome-applets/inhibit/libinhibit-applet.la \
$(top_builddir)/gnome-applets/mini-commander/libmini-commander-applet.la \
+ $(top_builddir)/gnome-applets/multiload/libmultiload-applet.la \
$(top_builddir)/gnome-applets/netspeed/libnet-speed-applet.la \
$(top_builddir)/gnome-applets/sticky-notes/libsticky-notes-applet.la \
$(top_builddir)/gnome-applets/timer/libtimer-applet.la \
@@ -155,6 +157,7 @@ ui_files = \
inhibit/inhibit-applet-menu.xml \
mini-commander/mini-commander.ui \
mini-commander/mini-commander-applet-menu.xml \
+ multiload/multiload-applet-menu.xml \
netspeed/netspeed-menu.xml \
sticky-notes/ui/sticky-notes-applet-menu.xml \
sticky-notes/ui/sticky-notes-delete.ui \
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 9d3d792b8..1a7061b1a 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -34,6 +34,7 @@
#include "gweather/gweather-applet.h"
#include "inhibit/inhibit-applet.h"
#include "mini-commander/mini-commander-applet.h"
+#include "multiload/multiload-applet.h"
#include "netspeed/netspeed-applet.h"
#include "sticky-notes/sticky-notes-applet.h"
#include "timer/timer-applet.h"
@@ -132,6 +133,13 @@ ga_get_applet_info (const char *id)
description = _("Mini-Commander");
icon_name = "gnome-mini-commander";
}
+ else if (g_strcmp0 (id, "multiload") == 0)
+ {
+ type_func = multiload_applet_get_type;
+ name = _("System Monitor");
+ description = _("A system load indicator");
+ icon_name = "utilities-system-monitor";
+ }
else if (g_strcmp0 (id, "netspeed") == 0)
{
type_func = netspeed_applet_get_type;
@@ -221,6 +229,8 @@ ga_get_applet_id_from_iid (const char *iid)
return "inhibit";
else if (g_strcmp0 (iid, "MiniCommanderAppletFactory::MiniCommanderApplet") == 0)
return "mini-commander";
+ else if (g_strcmp0 (iid, "MultiLoadAppletFactory::MultiLoadApplet") == 0)
+ return "multiload";
else if (g_strcmp0 (iid, "NetspeedAppletFactory::NetspeedApplet") == 0)
return "netspeed";
else if (g_strcmp0 (iid, "StickyNotesAppletFactory::StickyNotesApplet") == 0)
@@ -268,6 +278,7 @@ gp_module_load (GpModule *module)
"gweather",
"inhibit",
"mini-commander",
+ "multiload",
"netspeed",
"sticky-notes",
"timer",
diff --git a/multiload/src/Makefile.am b/gnome-applets/multiload/Makefile.am
similarity index 69%
rename from multiload/src/Makefile.am
rename to gnome-applets/multiload/Makefile.am
index d1f3e6a27..d690d76c4 100644
--- a/multiload/src/Makefile.am
+++ b/gnome-applets/multiload/Makefile.am
@@ -1,20 +1,14 @@
NULL =
-uidir = $(pkgdatadir)/ui
-
-multiload_appletlibdir = $(pkglibdir)
-multiload_appletlib_LTLIBRARIES = libmultiload-applet.la
+noinst_LTLIBRARIES = libmultiload-applet.la
libmultiload_applet_la_CPPFLAGS = \
- -I$(srcdir) \
- -DMULTILOAD_MENU_UI_DIR=\""$(uidir)"\" \
- -DGNOMELOCALEDIR=\""$(localedir)"\" \
-DG_LOG_DOMAIN=\"org.gnome.gnome-applets.multiload\" \
-DG_LOG_USE_STRUCTURED=1 \
$(NULL)
libmultiload_applet_la_CFLAGS = \
- $(GNOME_APPLETS_CFLAGS) \
+ $(GNOME_PANEL_CFLAGS) \
$(GTOP_APPLETS_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(WARN_CFLAGS) \
@@ -29,20 +23,20 @@ libmultiload_applet_la_SOURCES = \
linux-proc.h \
load-graph.h \
load-graph.c \
- main.c \
+ multiload-applet.c \
+ multiload-applet.h \
netspeed.c \
netspeed.h \
properties.c \
$(NULL)
libmultiload_applet_la_LDFLAGS = \
- -avoid-version \
$(WARN_LDFLAGS) \
$(AM_LDFLAGS) \
$(NULL)
libmultiload_applet_la_LIBADD = \
- $(GNOME_APPLETS_LIBS) \
+ $(GNOME_PANEL_LIBS) \
$(GTOP_APPLETS_LIBS) \
$(GIO_UNIX_LIBS) \
$(LIBM) \
diff --git a/multiload/src/autoscaler.c b/gnome-applets/multiload/autoscaler.c
similarity index 100%
rename from multiload/src/autoscaler.c
rename to gnome-applets/multiload/autoscaler.c
diff --git a/multiload/src/autoscaler.h b/gnome-applets/multiload/autoscaler.h
similarity index 100%
rename from multiload/src/autoscaler.h
rename to gnome-applets/multiload/autoscaler.h
diff --git a/multiload/src/global.h b/gnome-applets/multiload/global.h
similarity index 96%
rename from multiload/src/global.h
rename to gnome-applets/multiload/global.h
index 00b870b0a..2b2111798 100644
--- a/multiload/src/global.h
+++ b/gnome-applets/multiload/global.h
@@ -1,11 +1,12 @@
#ifndef __GLOBAL_H__
#define __GLOBAL_H__
+#include "multiload-applet.h"
+
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include <panel-applet.h>
G_BEGIN_DECLS
@@ -58,7 +59,6 @@ G_BEGIN_DECLS
#define IS_STRING_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
-typedef struct _MultiloadApplet MultiloadApplet;
typedef struct _LoadGraph LoadGraph;
typedef void (*LoadGraphDataFunc) (int, int [], LoadGraph *);
@@ -102,10 +102,11 @@ struct _LoadGraph {
struct _MultiloadApplet
{
- PanelApplet *applet;
+ GpApplet parent;
LoadGraph *graphs[NGRAPHS];
-
+
+ GtkOrientation orientation;
GtkWidget *box;
gboolean view_cpuload;
diff --git a/multiload/src/linux-proc.c b/gnome-applets/multiload/linux-proc.c
similarity index 100%
rename from multiload/src/linux-proc.c
rename to gnome-applets/multiload/linux-proc.c
diff --git a/multiload/src/linux-proc.h b/gnome-applets/multiload/linux-proc.h
similarity index 100%
rename from multiload/src/linux-proc.h
rename to gnome-applets/multiload/linux-proc.h
diff --git a/multiload/src/load-graph.c b/gnome-applets/multiload/load-graph.c
similarity index 96%
rename from multiload/src/load-graph.c
rename to gnome-applets/multiload/load-graph.c
index bc9ed5b51..32475536d 100644
--- a/multiload/src/load-graph.c
+++ b/gnome-applets/multiload/load-graph.c
@@ -9,11 +9,9 @@
#include <glib.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <panel-applet.h>
#include "global.h"
-
/*
Shifts data right
@@ -272,7 +270,6 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label,
const gchar *name, LoadGraphDataFunc get_data)
{
LoadGraph *g;
- PanelAppletOrient orient;
g = g_new0 (LoadGraph, 1);
g->netspeed_in = netspeed_new(g);
@@ -290,18 +287,15 @@ load_graph_new (MultiloadApplet *ma, guint n, const gchar *label,
g->main_widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- orient = panel_applet_get_orient (g->multiload->applet);
- switch (orient)
+
+ switch (ma->orientation)
{
- case PANEL_APPLET_ORIENT_UP:
- case PANEL_APPLET_ORIENT_DOWN:
+ case GTK_ORIENTATION_HORIZONTAL:
{
g->orient = FALSE;
break;
}
- case PANEL_APPLET_ORIENT_LEFT:
- case PANEL_APPLET_ORIENT_RIGHT:
+ case GTK_ORIENTATION_VERTICAL:
{
g->orient = TRUE;
break;
diff --git a/multiload/src/load-graph.h b/gnome-applets/multiload/load-graph.h
similarity index 100%
rename from multiload/src/load-graph.h
rename to gnome-applets/multiload/load-graph.h
diff --git a/gnome-applets/multiload/multiload-applet-menu.xml
b/gnome-applets/multiload/multiload-applet-menu.xml
new file mode 100644
index 000000000..e47916c91
--- /dev/null
+++ b/gnome-applets/multiload/multiload-applet-menu.xml
@@ -0,0 +1,24 @@
+<interface>
+ <menu id="multiload-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Open System Monitor</attribute>
+ <attribute name="action">multiload.run</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">multiload.preferences</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">multiload.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">multiload.about</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/multiload/src/main.c b/gnome-applets/multiload/multiload-applet.c
similarity index 74%
rename from multiload/src/main.c
rename to gnome-applets/multiload/multiload-applet.c
index 797b95f3c..bb7329fe4 100644
--- a/multiload/src/main.c
+++ b/gnome-applets/multiload/multiload-applet.c
@@ -23,17 +23,16 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <panel-applet.h>
#include "global.h"
+G_DEFINE_TYPE (MultiloadApplet, multiload_applet, GP_TYPE_APPLET)
+
static void
about_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- MultiloadApplet *ma = (MultiloadApplet *) user_data;
-
const gchar * const authors[] =
{
"Martin Baulig <martin home-of-linux org>",
@@ -72,7 +71,7 @@ help_cb (GSimpleAction *action,
MultiloadApplet *ma = (MultiloadApplet *) user_data;
GError *error = NULL;
- gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
+ gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma)),
"help:multiload",
gtk_get_current_event_time (),
&error);
@@ -82,8 +81,6 @@ help_cb (GSimpleAction *action,
g_error_free (error);
error = NULL;
}
-
-
}
/* run the full-scale system process monitor */
@@ -104,7 +101,7 @@ start_procman (MultiloadApplet *ma)
if (IS_STRING_EMPTY (monitor))
monitor = g_strdup ("gnome-system-monitor.desktop");
- screen = gtk_widget_get_screen (GTK_WIDGET (ma->applet));
+ screen = gtk_widget_get_screen (GTK_WIDGET (ma));
appinfo = g_desktop_app_info_new (monitor);
if (appinfo) {
GdkAppLaunchContext *context;
@@ -159,7 +156,7 @@ start_procman (MultiloadApplet *ma)
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_screen (GTK_WINDOW (dialog),
- gtk_widget_get_screen (GTK_WIDGET (ma->applet)));
+ gtk_widget_get_screen (GTK_WIDGET (ma)));
gtk_widget_show (dialog);
@@ -177,51 +174,15 @@ start_procman_cb (GSimpleAction *action,
}
static void
-multiload_change_orient_cb(PanelApplet *applet, gint arg1, gpointer data)
-{
- MultiloadApplet *ma = data;
- multiload_applet_refresh((MultiloadApplet *)data);
- gtk_widget_show (GTK_WIDGET (ma->applet));
- return;
-}
-
-static void
-multiload_destroy_cb(GtkWidget *widget, gpointer data)
+placement_changed_cb (GpApplet *applet,
+ GtkOrientation orientation,
+ GtkPositionType position,
+ MultiloadApplet *self)
{
- gint i;
- MultiloadApplet *ma = data;
-
- for (i = 0; i < NGRAPHS; i++)
- {
- load_graph_stop(ma->graphs[i]);
- if (ma->graphs[i]->colors)
- {
- g_free (ma->graphs[i]->colors);
- ma->graphs[i]->colors = NULL;
- }
- gtk_widget_destroy(ma->graphs[i]->main_widget);
-
- load_graph_unalloc(ma->graphs[i]);
- g_free(ma->graphs[i]);
- }
-
- if (ma->settings)
- g_object_unref (ma->settings);
-
- if (ma->about_dialog)
- gtk_widget_destroy (ma->about_dialog);
-
- if (ma->prop_dialog)
- gtk_widget_destroy (ma->prop_dialog);
-
- gtk_widget_destroy(GTK_WIDGET(ma->applet));
-
- g_free (ma);
-
- return;
+ self->orientation = orientation;
+ multiload_applet_refresh (self);
}
-
static gboolean
multiload_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, MultiloadApplet *ma)
{
@@ -397,7 +358,6 @@ void
multiload_applet_refresh(MultiloadApplet *ma)
{
gint i;
- PanelAppletOrient orientation;
/* stop and free the old graphs */
for (i = 0; i < NGRAPHS; i++)
@@ -414,18 +374,15 @@ multiload_applet_refresh(MultiloadApplet *ma)
if (ma->box)
gtk_widget_destroy(ma->box);
-
- orientation = panel_applet_get_orient(ma->applet);
-
- if ( (orientation == PANEL_APPLET_ORIENT_UP) ||
- (orientation == PANEL_APPLET_ORIENT_DOWN) ) {
+
+ if (ma->orientation == GTK_ORIENTATION_HORIZONTAL) {
ma->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
}
else
ma->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- gtk_container_add(GTK_CONTAINER(ma->applet), ma->box);
-
+
+ gtk_container_add (GTK_CONTAINER (ma), ma->box);
+
/* create the NGRAPHS graphs, passing in their user-configurable properties. */
multiload_create_graphs (ma);
@@ -449,90 +406,117 @@ static const GActionEntry multiload_menu_actions [] = {
{ "run", start_procman_cb, NULL, NULL, NULL },
{ "preferences", multiload_properties_cb, NULL, NULL, NULL },
{ "help", help_cb, NULL, NULL, NULL },
- { "about", about_cb, NULL, NULL, NULL }
+ { "about", about_cb, NULL, NULL, NULL },
+ { NULL }
};
-/* create a box and stuff the load graphs inside of it */
static gboolean
-multiload_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
+multiload_applet_setup (MultiloadApplet *ma)
{
- MultiloadApplet *ma;
GSettings *settings;
- GSimpleActionGroup *action_group;
+ const char *menu_resource;
GAction *action;
- gchar *ui_path;
-
- ma = g_new0(MultiloadApplet, 1);
-
- ma->applet = applet;
-
+
ma->about_dialog = NULL;
ma->prop_dialog = NULL;
- ma->last_clicked = 0;
+ ma->last_clicked = 0;
- ma->settings = panel_applet_settings_new (applet, MULTILOAD_SCHEMA);
- panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
+ ma->settings = gp_applet_settings_new (GP_APPLET (ma), MULTILOAD_SCHEMA);
+ gp_applet_set_flags (GP_APPLET (ma), GP_APPLET_FLAGS_EXPAND_MINOR);
- action_group = g_simple_action_group_new ();
- g_action_map_add_action_entries (G_ACTION_MAP (action_group),
- multiload_menu_actions,
- G_N_ELEMENTS (multiload_menu_actions),
- ma);
- ui_path = g_build_filename (MULTILOAD_MENU_UI_DIR, "multiload-applet-menu.xml", NULL);
- panel_applet_setup_menu_from_file (applet, ui_path, action_group, GETTEXT_PACKAGE);
- g_free (ui_path);
+ ma->orientation = gp_applet_get_orientation (GP_APPLET (ma));
- gtk_widget_insert_action_group (GTK_WIDGET (applet), "multiload",
- G_ACTION_GROUP (action_group));
+ menu_resource = GRESOURCE_PREFIX "/ui/multiload-applet-menu.xml";
+ gp_applet_setup_menu_from_resource (GP_APPLET (ma),
+ menu_resource,
+ multiload_menu_actions);
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
- g_object_bind_property (applet, "locked-down", action, "enabled",
+ action = gp_applet_menu_lookup_action (GP_APPLET (ma), "preferences");
+ g_object_bind_property (ma, "locked-down", action, "enabled",
G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
settings = g_settings_new (GNOME_DESKTOP_LOCKDOWN_SCHEMA);
if (g_settings_get_boolean (settings, DISABLE_COMMAND_LINE) ||
- panel_applet_get_locked_down (applet)) {
+ gp_applet_get_locked_down (GP_APPLET (ma))) {
/* When the panel is locked down or when the command line is inhibited,
it seems very likely that running the procman would be at least harmful */
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "run");
+ action = gp_applet_menu_lookup_action (GP_APPLET (ma), "run");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
}
g_object_unref (settings);
- g_object_unref (action_group);
-
- g_signal_connect(G_OBJECT(applet), "change_orient",
- G_CALLBACK(multiload_change_orient_cb), ma);
- g_signal_connect(G_OBJECT(applet), "destroy",
- G_CALLBACK(multiload_destroy_cb), ma);
- g_signal_connect(G_OBJECT(applet), "button_press_event",
- G_CALLBACK(multiload_button_press_event_cb), ma);
- g_signal_connect(G_OBJECT(applet), "key_press_event",
- G_CALLBACK(multiload_key_press_event_cb), ma);
-
+
+ g_signal_connect (ma,
+ "placement-changed",
+ G_CALLBACK (placement_changed_cb),
+ ma);
+
+ g_signal_connect (ma,
+ "button-press-event",
+ G_CALLBACK (multiload_button_press_event_cb),
+ ma);
+
+ g_signal_connect (ma,
+ "key-press-event",
+ G_CALLBACK (multiload_key_press_event_cb),
+ ma);
+
multiload_applet_refresh (ma);
-
- gtk_widget_show(GTK_WIDGET(applet));
-
- return TRUE;
+
+ gtk_widget_show (GTK_WIDGET (ma));
}
-static gboolean
-multiload_factory (PanelApplet *applet,
- const gchar *iid,
- gpointer data)
+static void
+multiload_applet_constructed (GObject *object)
{
- gboolean retval = FALSE;
-
- glibtop_init();
+ G_OBJECT_CLASS (multiload_applet_parent_class)->constructed (object);
+ multiload_applet_setup (MULTILOAD_APPLET (object));
+}
- retval = multiload_applet_new(applet, iid, data);
-
- return retval;
+static void
+multiload_applet_dispose (GObject *object)
+{
+ MultiloadApplet *self;
+ int i;
+
+ self = MULTILOAD_APPLET (object);
+
+ for (i = 0; i < NGRAPHS; i++)
+ {
+ if (self->graphs[i] != NULL)
+ {
+ load_graph_stop (self->graphs[i]);
+
+ g_clear_pointer (&self->graphs[i]->colors, g_free);
+ g_clear_pointer (&self->graphs[i]->main_widget, gtk_widget_destroy);
+
+ load_graph_unalloc (self->graphs[i]);
+ g_free (self->graphs[i]);
+ self->graphs[i] = NULL;
+ }
+ }
+
+ g_clear_object (&self->settings);
+
+ g_clear_pointer (&self->about_dialog, gtk_widget_destroy);
+ g_clear_pointer (&self->prop_dialog, gtk_widget_destroy);
+
+ G_OBJECT_CLASS (multiload_applet_parent_class)->dispose (object);
}
-PANEL_APPLET_IN_PROCESS_FACTORY ("MultiLoadAppletFactory",
- PANEL_TYPE_APPLET,
- multiload_factory,
- NULL)
+static void
+multiload_applet_class_init (MultiloadAppletClass *self_class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (self_class);
+
+ object_class->constructed = multiload_applet_constructed;
+ object_class->dispose = multiload_applet_dispose;
+}
+
+static void
+multiload_applet_init (MultiloadApplet *self)
+{
+}
diff --git a/gnome-applets/multiload/multiload-applet.h b/gnome-applets/multiload/multiload-applet.h
new file mode 100644
index 000000000..041c13b32
--- /dev/null
+++ b/gnome-applets/multiload/multiload-applet.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MULTILOAD_APPLET_H
+#define MULTILOAD_APPLET_H
+
+#include <libgnome-panel/gp-applet.h>
+
+G_BEGIN_DECLS
+
+#define MULTILOAD_TYPE_APPLET (multiload_applet_get_type ())
+G_DECLARE_FINAL_TYPE (MultiloadApplet, multiload_applet,
+ MULTILOAD, APPLET, GpApplet)
+
+G_END_DECLS
+
+#endif
diff --git a/multiload/src/netspeed.c b/gnome-applets/multiload/netspeed.c
similarity index 100%
rename from multiload/src/netspeed.c
rename to gnome-applets/multiload/netspeed.c
diff --git a/multiload/src/netspeed.h b/gnome-applets/multiload/netspeed.h
similarity index 100%
rename from multiload/src/netspeed.h
rename to gnome-applets/multiload/netspeed.h
diff --git a/multiload/src/properties.c b/gnome-applets/multiload/properties.c
similarity index 98%
rename from multiload/src/properties.c
rename to gnome-applets/multiload/properties.c
index 29dc7181a..eeabc189a 100644
--- a/multiload/src/properties.c
+++ b/gnome-applets/multiload/properties.c
@@ -3,17 +3,12 @@
*
* Authors:
* Todd Kulesza
- *
- *
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
-#include <panel-applet.h>
#include "global.h"
@@ -80,7 +75,7 @@ properties_close_cb (GtkWidget *widget, gint arg, MultiloadApplet *ma)
{
case GTK_RESPONSE_HELP:
- gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
+ gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma)),
"help:multiload/multiload-prefs",
gtk_get_current_event_time (),
&error);
@@ -284,7 +279,6 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
GtkWidget *indent;
GtkWidget *spin_button;
GtkWidget *label;
- PanelAppletOrient orient;
GtkSizeGroup *label_size;
GtkSizeGroup *spin_size;
gchar *label_text;
@@ -437,13 +431,12 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_widget_show (control_hbox);
label_size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- orient = panel_applet_get_orient(ma->applet);
- if ( (orient == PANEL_APPLET_ORIENT_UP) || (orient == PANEL_APPLET_ORIENT_DOWN) )
+
+ if (ma->orientation == GTK_ORIENTATION_HORIZONTAL)
label_text = g_strdup(_("System m_onitor width: "));
else
label_text = g_strdup(_("System m_onitor height: "));
-
+
label = gtk_label_new_with_mnemonic(label_text);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_size_group_add_widget (label_size, label);
@@ -598,7 +591,7 @@ multiload_properties_cb (GSimpleAction *action,
dialog = ma->prop_dialog;
gtk_window_set_screen (GTK_WINDOW (dialog),
- gtk_widget_get_screen (GTK_WIDGET (ma->applet)));
+ gtk_widget_get_screen (GTK_WIDGET (ma)));
gtk_notebook_set_current_page (GTK_NOTEBOOK (ma->notebook),
ma->last_clicked);
@@ -612,7 +605,7 @@ multiload_properties_cb (GSimpleAction *action,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_screen (GTK_WINDOW (dialog),
- gtk_widget_get_screen (GTK_WIDGET (ma->applet)));
+ gtk_widget_get_screen (GTK_WIDGET (ma)));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
diff --git a/multiload/src/properties.h b/gnome-applets/multiload/properties.h
similarity index 100%
rename from multiload/src/properties.h
rename to gnome-applets/multiload/properties.h
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d061eb55f..e5d9c5ad4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -55,6 +55,10 @@ gnome-applets/mini-commander/mini-commander-applet.c
[type: gettext/glade]gnome-applets/mini-commander/mini-commander-applet-menu.xml
[type: gettext/glade]gnome-applets/mini-commander/mini-commander.ui
gnome-applets/mini-commander/preferences.c
+[type: gettext/glade]gnome-applets/multiload/multiload-applet-menu.xml
+gnome-applets/multiload/multiload-applet.c
+gnome-applets/multiload/netspeed.c
+gnome-applets/multiload/properties.c
[type: gettext/glade]gnome-applets/netspeed/netspeed-menu.xml
gnome-applets/netspeed/netspeed-applet.c
gnome-applets/netspeed/preferences.c
@@ -88,13 +92,6 @@ gnome-applets/window-picker/wp-task-title.c
[type: gettext/glade]gnome-applets/window-title/window-title.ui
[type: gettext/glade]gnome-applets/window-title/window-title-menu.xml
gnome-applets/window-title/window-title.c
-[type: gettext/glade]multiload/multiload-applet-menu.xml
-[type: gettext/ini]multiload/org.gnome.applets.MultiLoadApplet.panel-applet.in.in
-multiload/src/linux-proc.c
-multiload/src/load-graph.c
-multiload/src/main.c
-multiload/src/netspeed.c
-multiload/src/properties.c
[type: gettext/ini]window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
window-buttons/windowbuttons.c
[type: gettext/glade]window-buttons/windowbuttons.ui
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index f4a8c9261..e8c08ce83 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -17,5 +17,4 @@ data/schemas/org.gnome.gnome-applets.timer.gschema.xml.in
data/schemas/org.gnome.gnome-applets.window-buttons.gschema.xml.in
data/schemas/org.gnome.gnome-applets.window-picker-applet.gschema.xml.in
data/schemas/org.gnome.gnome-applets.window-title.gschema.xml.in
-multiload/org.gnome.applets.MultiLoadApplet.panel-applet.in
window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]