placesviewrow: Put event controllers into ui file

This commit is contained in:
Benjamin Otte 2018-03-09 06:07:44 +01:00 committed by Carlos Garnacho
parent c2ec738a2e
commit fa97236b62
2 changed files with 9 additions and 8 deletions

View File

@ -28,13 +28,13 @@
*/
#ifdef GTK_COMPILATION
#include "gtkbutton.h"
#include "gtkgesture.h"
#include "gtkimage.h"
#include "gtkintl.h"
#include "gtklabel.h"
#include "gtkspinner.h"
#include "gtkstack.h"
#include "gtktypebuiltins.h"
#include "gtkgesturemultipress.h"
#else
#include <gtk/gtk.h>
#endif
@ -56,8 +56,6 @@ struct _GtkPlacesViewRow
GMount *mount;
GFile *file;
GtkGesture *gesture;
GCancellable *cancellable;
gint is_network : 1;
@ -216,7 +214,6 @@ gtk_places_view_row_finalize (GObject *object)
g_clear_object (&self->mount);
g_clear_object (&self->file);
g_clear_object (&self->cancellable);
g_clear_object (&self->gesture);
G_OBJECT_CLASS (gtk_places_view_row_parent_class)->finalize (object);
}
@ -392,16 +389,14 @@ gtk_places_view_row_class_init (GtkPlacesViewRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, icon_image);
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, name_label);
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, path_label);
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
}
static void
gtk_places_view_row_init (GtkPlacesViewRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
self->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self));
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (self->gesture, "pressed", G_CALLBACK (pressed_cb), self);
}
GtkWidget*

View File

@ -84,5 +84,11 @@
</child>
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb" swapped="no"/>
</object>
</child>
</template>
</interface>