[gnome-flashback] desktop: remove show-properties signal from GfIcon
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] desktop: remove show-properties signal from GfIcon
- Date: Wed, 13 Nov 2019 22:33:36 +0000 (UTC)
commit 0cd9c7915911eb227e5e50563153fc1b43f3ae0a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Nov 13 22:35:04 2019 +0200
desktop: remove show-properties signal from GfIcon
gnome-flashback/libdesktop/gf-icon-view.c | 66 ++++++++++---------------------
gnome-flashback/libdesktop/gf-icon-view.h | 9 ++++-
gnome-flashback/libdesktop/gf-icon.c | 43 ++++++++++++++++----
3 files changed, 63 insertions(+), 55 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/gf-icon-view.c b/gnome-flashback/libdesktop/gf-icon-view.c
index 88197b0..bce0106 100644
--- a/gnome-flashback/libdesktop/gf-icon-view.c
+++ b/gnome-flashback/libdesktop/gf-icon-view.c
@@ -296,48 +296,6 @@ show_item_properties_cb (GObject *object,
}
}
-static void
-icon_show_properties_cb (GfIcon *icon,
- GfIconView *self)
-{
- int n_uris;
- char **uris;
- GFile *file;
- GList *l;
- int i;
-
- if (self->file_manager == NULL)
- return;
-
- n_uris = g_list_length (self->selected_icons);
- uris = g_new0 (char *, n_uris + 1);
-
- file = gf_icon_get_file (icon);
- uris[0] = g_file_get_uri (file);
-
- for (l = self->selected_icons, i = 1; l != NULL; l = l->next, i++)
- {
- GfIcon *other_icon;
-
- other_icon = l->data;
-
- if (other_icon == icon)
- continue;
-
- file = gf_icon_get_file (other_icon);
- uris[i] = g_file_get_uri (file);
- }
-
- gf_file_manager_gen_call_show_item_properties (self->file_manager,
- (const char * const *) uris,
- "",
- self->cancellable,
- show_item_properties_cb,
- NULL);
-
- g_strfreev (uris);
-}
-
static GfIconInfo *
create_icon_info (GfIconView *self,
GFile *file,
@@ -351,10 +309,6 @@ create_icon_info (GfIconView *self,
G_CALLBACK (icon_selected_cb),
self);
- g_signal_connect (icon, "show-properties",
- G_CALLBACK (icon_show_properties_cb),
- self);
-
g_settings_bind (self->settings, "icon-size",
icon, "icon-size",
G_SETTINGS_BIND_GET);
@@ -1571,3 +1525,23 @@ gf_icon_view_set_representative_color (GfIconView *self,
gtk_css_provider_load_from_data (self->rubberband_css, "", -1, NULL);
}
}
+
+GList *
+gf_icon_view_get_selected_icons (GfIconView *self)
+{
+ return self->selected_icons;
+}
+
+void
+gf_icon_view_show_item_properties (GfIconView *self,
+ const char * const *uris)
+{
+ if (self->file_manager == NULL)
+ return;
+
+ gf_file_manager_gen_call_show_item_properties (self->file_manager,
+ uris, "",
+ self->cancellable,
+ show_item_properties_cb,
+ NULL);
+}
diff --git a/gnome-flashback/libdesktop/gf-icon-view.h b/gnome-flashback/libdesktop/gf-icon-view.h
index d9fc068..fcabc46 100644
--- a/gnome-flashback/libdesktop/gf-icon-view.h
+++ b/gnome-flashback/libdesktop/gf-icon-view.h
@@ -27,8 +27,13 @@ G_DECLARE_FINAL_TYPE (GfIconView, gf_icon_view, GF, ICON_VIEW, GtkEventBox)
GtkWidget *gf_icon_view_new (void);
-void gf_icon_view_set_representative_color (GfIconView *self,
- GdkRGBA *color);
+void gf_icon_view_set_representative_color (GfIconView *self,
+ GdkRGBA *color);
+
+GList *gf_icon_view_get_selected_icons (GfIconView *self);
+
+void gf_icon_view_show_item_properties (GfIconView *self,
+ const char * const *uris);
G_END_DECLS
diff --git a/gnome-flashback/libdesktop/gf-icon.c b/gnome-flashback/libdesktop/gf-icon.c
index e583ffb..83ce9b4 100644
--- a/gnome-flashback/libdesktop/gf-icon.c
+++ b/gnome-flashback/libdesktop/gf-icon.c
@@ -63,8 +63,6 @@ enum
{
SELECTED,
- SHOW_PROPERTIES,
-
LAST_SIGNAL
};
@@ -121,7 +119,42 @@ static void
properties_cb (GtkMenuItem *item,
GfIcon *self)
{
- g_signal_emit (self, icon_signals[SHOW_PROPERTIES], 0);
+ GfIconPrivate *priv;
+ GList *selected_icons;
+ int n_uris;
+ char **uris;
+ GFile *file;
+ GList *l;
+ int i;
+
+ priv = gf_icon_get_instance_private (self);
+
+ selected_icons = gf_icon_view_get_selected_icons (priv->icon_view);
+ if (selected_icons == NULL)
+ return;
+
+ n_uris = g_list_length (selected_icons);
+ uris = g_new0 (char *, n_uris + 1);
+
+ file = gf_icon_get_file (self);
+ uris[0] = g_file_get_uri (file);
+
+ for (l = selected_icons, i = 1; l != NULL; l = l->next, i++)
+ {
+ GfIcon *icon;
+
+ icon = l->data;
+ if (icon == self)
+ continue;
+
+ file = gf_icon_get_file (icon);
+ uris[i] = g_file_get_uri (file);
+ }
+
+ gf_icon_view_show_item_properties (priv->icon_view,
+ (const char * const *) uris);
+
+ g_strfreev (uris);
}
static GtkWidget *
@@ -469,10 +502,6 @@ install_signals (void)
g_signal_new ("selected", GF_TYPE_ICON, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, G_TYPE_NONE, 1,
GF_TYPE_ICON_SELECTED_FLAGS);
-
- icon_signals[SHOW_PROPERTIES] =
- g_signal_new ("show-properties", GF_TYPE_ICON, G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]