[nautilus/wip/exalm/libhandy: 1/3] window-slot: Make allow_stop and title actual properties
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/exalm/libhandy: 1/3] window-slot: Make allow_stop and title actual properties
- Date: Thu, 21 Jul 2022 14:28:09 +0000 (UTC)
commit 635d6f271b790eb9dd80d7a61a3179a9fb5bfd91
Author: António Fernandes <antoniof gnome org>
Date: Thu Jul 21 15:35:54 2022 +0200
window-slot: Make allow_stop and title actual properties
Based on larger patch by Alexander Mikhaylenko
src/nautilus-window-slot.c | 45 ++++++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 3b0a83baf..5f56f7ffd 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -62,6 +62,8 @@ enum
PROP_SELECTION,
PROP_LOCATION,
PROP_TOOLTIP,
+ PROP_ALLOW_STOP,
+ PROP_TITLE,
NUM_PROPERTIES
};
@@ -865,6 +867,18 @@ nautilus_window_slot_get_property (GObject *object,
}
break;
+ case PROP_ALLOW_STOP:
+ {
+ g_value_set_boolean (value, nautilus_window_slot_get_allow_stop (self));
+ }
+ break;
+
+ case PROP_TITLE:
+ {
+ g_value_set_string (value, nautilus_window_slot_get_title (self));
+ }
+ break;
+
default:
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -928,6 +942,7 @@ nautilus_window_slot_constructed (GObject *object)
G_BINDING_DEFAULT);
self->title = g_strdup (_("Loading…"));
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TITLE]);
}
static void
@@ -3063,6 +3078,16 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
NULL,
G_PARAM_READWRITE);
+ properties[PROP_ALLOW_STOP] =
+ g_param_spec_boolean ("allow-stop", "", "",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_TITLE] =
+ g_param_spec_string ("title", "", "",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
@@ -3133,7 +3158,7 @@ void
nautilus_window_slot_update_title (NautilusWindowSlot *self)
{
NautilusWindow *window;
- char *title;
+ g_autofree char *title = NULL;
gboolean do_sync = FALSE;
title = nautilus_compute_title_for_location (self->location);
window = nautilus_window_slot_get_window (self);
@@ -3143,24 +3168,12 @@ nautilus_window_slot_update_title (NautilusWindowSlot *self)
do_sync = TRUE;
g_free (self->title);
- self->title = title;
- title = NULL;
- }
+ self->title = g_steal_pointer (&title);
- if (strlen (self->title) > 0)
- {
- do_sync = TRUE;
- }
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TITLE]);
- if (do_sync)
- {
nautilus_window_sync_title (window, self);
}
-
- if (title != NULL)
- {
- g_free (title);
- }
}
gboolean
@@ -3180,6 +3193,8 @@ nautilus_window_slot_set_allow_stop (NautilusWindowSlot *self,
window = nautilus_window_slot_get_window (self);
nautilus_window_sync_allow_stop (window, self);
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ALLOW_STOP]);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]