mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
sidebarrow: Avoid object-valued properties
They tend to leak...as these do.
This commit is contained in:
parent
9f27ee7f5a
commit
f2a8ddfecf
@ -426,15 +426,15 @@ add_place (GtkPlacesSidebar *sidebar,
|
||||
NULL);
|
||||
|
||||
g_free (tooltip_escaped);
|
||||
g_object_get (row,
|
||||
"eject-button", &eject_button,
|
||||
"event-box", &event_box,
|
||||
NULL);
|
||||
g_signal_connect_swapped (eject_button, "clicked", G_CALLBACK (eject_or_unmount_bookmark), row);
|
||||
/* Needs event box since GtkListBoxRow doesn't have a GdkWindow associated that can
|
||||
* listen events */
|
||||
g_signal_connect (event_box, "button-press-event", G_CALLBACK (on_button_press_event), row);
|
||||
g_signal_connect (event_box, "button-release-event", G_CALLBACK (on_button_release_event), row);
|
||||
eject_button = gtk_sidebar_row_get_eject_button (GTK_SIDEBAR_ROW (row));
|
||||
event_box = gtk_sidebar_row_get_event_box (GTK_SIDEBAR_ROW (row));
|
||||
|
||||
g_signal_connect_swapped (eject_button, "clicked",
|
||||
G_CALLBACK (eject_or_unmount_bookmark), row);
|
||||
g_signal_connect (event_box, "button-press-event",
|
||||
G_CALLBACK (on_button_press_event), row);
|
||||
g_signal_connect (event_box, "button-release-event",
|
||||
G_CALLBACK (on_button_release_event), row);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sidebar->list_box), GTK_WIDGET (row));
|
||||
gtk_widget_show_all (row);
|
||||
|
@ -70,8 +70,6 @@ enum
|
||||
PROP_MOUNT,
|
||||
PROP_SENSITIVE,
|
||||
PROP_PLACEHOLDER,
|
||||
PROP_EJECT_BUTTON,
|
||||
PROP_EVENT_BOX,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@ -171,18 +169,6 @@ gtk_sidebar_row_get_property (GObject *object,
|
||||
break;
|
||||
}
|
||||
|
||||
case PROP_EJECT_BUTTON:
|
||||
{
|
||||
g_value_set_object (value, self->eject_button);
|
||||
break;
|
||||
}
|
||||
|
||||
case PROP_EVENT_BOX:
|
||||
{
|
||||
g_value_set_object (value, self->event_box);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -576,26 +562,6 @@ gtk_sidebar_row_class_init (GtkSidebarRowClass *klass)
|
||||
g_object_class_install_property (object_class, PROP_PLACEHOLDER,
|
||||
gParamSpecs [PROP_PLACEHOLDER]);
|
||||
|
||||
gParamSpecs [PROP_EJECT_BUTTON] =
|
||||
g_param_spec_object ("eject-button",
|
||||
"Eject Button",
|
||||
"Eject button",
|
||||
GTK_TYPE_WIDGET,
|
||||
(G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (object_class, PROP_EJECT_BUTTON,
|
||||
gParamSpecs [PROP_EJECT_BUTTON]);
|
||||
|
||||
gParamSpecs [PROP_EVENT_BOX] =
|
||||
g_param_spec_object ("event-box",
|
||||
"Event Box",
|
||||
"Event Box",
|
||||
GTK_TYPE_WIDGET,
|
||||
(G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (object_class, PROP_EVENT_BOX,
|
||||
gParamSpecs [PROP_EVENT_BOX]);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/libgtk/ui/gtksidebarrow.ui");
|
||||
|
||||
@ -612,18 +578,30 @@ gtk_sidebar_row_class_init (GtkSidebarRowClass *klass)
|
||||
GtkSidebarRow*
|
||||
gtk_sidebar_row_clone (GtkSidebarRow *self)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_SIDEBAR_ROW,
|
||||
"sidebar", self->sidebar,
|
||||
"icon", self->icon,
|
||||
"label", self->label,
|
||||
"tooltip", self->tooltip,
|
||||
"ejectable", self->ejectable,
|
||||
"order-index", self->order_index,
|
||||
"section-type", self->section_type,
|
||||
"place-type", self->place_type,
|
||||
"uri", self->uri,
|
||||
"drive", self->drive,
|
||||
"volume", self->volume,
|
||||
"mount", self->mount,
|
||||
NULL);
|
||||
return g_object_new (GTK_TYPE_SIDEBAR_ROW,
|
||||
"sidebar", self->sidebar,
|
||||
"icon", self->icon,
|
||||
"label", self->label,
|
||||
"tooltip", self->tooltip,
|
||||
"ejectable", self->ejectable,
|
||||
"order-index", self->order_index,
|
||||
"section-type", self->section_type,
|
||||
"place-type", self->place_type,
|
||||
"uri", self->uri,
|
||||
"drive", self->drive,
|
||||
"volume", self->volume,
|
||||
"mount", self->mount,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_sidebar_row_get_eject_button (GtkSidebarRow *self)
|
||||
{
|
||||
return self->eject_button;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_sidebar_row_get_event_box (GtkSidebarRow *self)
|
||||
{
|
||||
return self->event_box;
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ void gtk_sidebar_row_hide (GtkSidebarRow *self,
|
||||
gboolean inmediate);
|
||||
void gtk_sidebar_row_reveal (GtkSidebarRow *self);
|
||||
|
||||
GtkWidget *gtk_sidebar_row_get_eject_button (GtkSidebarRow *self);
|
||||
GtkWidget *gtk_sidebar_row_get_event_box (GtkSidebarRow *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GTK_SIDEBAR_ROW_PRIVATE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user