summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-08 23:55:57 +0100
committerraveit65 <[email protected]>2020-02-29 15:49:49 +0100
commit175cb61ffe40180b4569a50f12ac89aa12e1dadd (patch)
tree2bd089b30fdf17d1e87bd9ca4d3c683bfe3f684a
parentc316f3243e8f4860f9b1ae9bbdf5b4eb6907ca45 (diff)
downloadmate-applets-175cb61ffe40180b4569a50f12ac89aa12e1dadd.tar.bz2
mate-applets-175cb61ffe40180b4569a50f12ac89aa12e1dadd.tar.xz
drivemount: Remove global variable
-rw-r--r--drivemount/drive-list.c11
-rw-r--r--drivemount/drive-list.h3
-rw-r--r--drivemount/drivemount.c7
3 files changed, 10 insertions, 11 deletions
diff --git a/drivemount/drive-list.c b/drivemount/drive-list.c
index 1b3679b3..97e28573 100644
--- a/drivemount/drive-list.c
+++ b/drivemount/drive-list.c
@@ -32,8 +32,6 @@
G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_GRID);
-GSettings *settings;
-
static GVolumeMonitor *volume_monitor = NULL;
static void drive_list_finalize (GObject *object);
@@ -89,9 +87,15 @@ drive_list_init (DriveList *self)
self->mounts = g_hash_table_new (NULL, NULL);
self->orientation = GTK_ORIENTATION_HORIZONTAL;
self->layout_tag = 0;
+ self->settings = g_settings_new ("org.mate.drivemount");
self->icon_size = 24;
self->relief = GTK_RELIEF_NORMAL;
+ g_signal_connect(self->settings,
+ "changed::drivemount-checkmark-color",
+ G_CALLBACK (settings_color_changed),
+ self);
+
/* listen for drive connects/disconnects, and add
* currently connected drives. */
self->count = 0;
@@ -154,8 +158,7 @@ drive_list_finalize (GObject *object)
g_hash_table_destroy (self->volumes);
g_hash_table_destroy (self->mounts);
-
- g_object_unref (settings);
+ g_object_unref (self->settings);
if (G_OBJECT_CLASS (drive_list_parent_class)->finalize)
(* G_OBJECT_CLASS (drive_list_parent_class)->finalize) (object);
diff --git a/drivemount/drive-list.h b/drivemount/drive-list.h
index ea55b908..96eb189a 100644
--- a/drivemount/drive-list.h
+++ b/drivemount/drive-list.h
@@ -49,6 +49,8 @@ struct _DriveList
GtkWidget *dummy;
gint count;
+ GSettings *settings;
+
int icon_size;
};
@@ -65,7 +67,6 @@ void drive_list_set_panel_size (DriveList *list,
int panel_size);
void drive_list_set_transparent (DriveList *self,
gboolean transparent);
-extern GSettings *settings;
void drive_list_redraw (DriveList *self);
void settings_color_changed (GSettings *settings, gchar *key, DriveList *drive_list);
diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c
index 311b628d..84d6f77f 100644
--- a/drivemount/drivemount.c
+++ b/drivemount/drivemount.c
@@ -189,13 +189,8 @@ applet_factory (MatePanelApplet *applet,
mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet));
- settings = g_settings_new ( "org.mate.drivemount");
-
drive_list = drive_list_new ();
- g_signal_connect(settings,
- "changed::drivemount-checkmark-color",
- G_CALLBACK (settings_color_changed),
- drive_list);
+
gtk_container_add (GTK_CONTAINER (applet), drive_list);
g_signal_connect_object (applet, "change_orient",