[gtk+/wip/gbsneto/placessidebar-locations] placesview: update interface
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gbsneto/placessidebar-locations] placesview: update interface
- Date: Sun, 31 May 2015 15:40:46 +0000 (UTC)
commit fe272aaf71c9836edd2dbc3bcb6871d04b0bb8d2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun May 31 12:39:54 2015 -0300
placesview: update interface
gtk/gtkplacesview.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++-
gtk/gtkplacesview.h | 20 ++++++++++---
gtk/ui/gtkplacesview.ui | 33 ++++++++-------------
3 files changed, 98 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 46fc627..aefe185 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -22,6 +22,8 @@
struct _GtkPlacesViewPrivate
{
+ GVolumeMonitor *volume_monitor;
+
guint local_only : 1;
};
@@ -35,6 +37,26 @@ enum {
static GParamSpec *properties [LAST_PROP];
+static gboolean
+gtk_places_view_real_get_local_only (GtkPlacesView *view)
+{
+ return view->priv->local_only;
+}
+
+static void
+gtk_places_view_real_set_local_only (GtkPlacesView *view,
+ gboolean local_only)
+{
+ if (view->priv->local_only != local_only)
+ {
+ view->priv->local_only = local_only;
+
+ /* TODO: implement me */
+
+ g_object_notify_by_pspec (G_OBJECT (view), properties [PROP_LOCAL_ONLY]);
+ }
+}
+
static void
gtk_places_view_finalize (GObject *object)
{
@@ -54,6 +76,10 @@ gtk_places_view_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_LOCAL_ONLY:
+ g_value_set_boolean (value, gtk_places_view_get_local_only (self));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -69,6 +95,10 @@ gtk_places_view_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_LOCAL_ONLY:
+ gtk_places_view_set_local_only (self, g_value_get_boolean (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -78,15 +108,23 @@ static void
gtk_places_view_class_init (GtkPlacesViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ klass->set_local_only = gtk_places_view_real_set_local_only;
+ klass->get_local_only = gtk_places_view_real_get_local_only;
object_class->finalize = gtk_places_view_finalize;
object_class->get_property = gtk_places_view_get_property;
object_class->set_property = gtk_places_view_set_property;
+
+ /* Bind class to template */
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkplacesview.ui");
}
static void
gtk_places_view_init (GtkPlacesView *self)
{
+ gtk_widget_init_template (GTK_WIDGET (self));
}
/**
@@ -105,5 +143,37 @@ gtk_places_view_init (GtkPlacesView *self)
GtkWidget *
gtk_places_view_new (void)
{
- return g_object_new (GTKPLACESVIEW_TYPE_, NULL);
+ return g_object_new (GTK_TYPE_PLACES_VIEW, NULL);
+}
+
+/**
+ * gtkplacesview_func:
+ *
+ * %TRUE if only local volumes are shown, %FALSE otherwise.
+ */
+gboolean
+gtk_places_view_get_local_only (GtkPlacesView *view)
+{
+ GtkPlacesViewClass *class;
+
+ g_return_val_if_fail (GTK_IS_PLACES_VIEW (view), FALSE);
+
+ class = GTK_PLACES_VIEW_GET_CLASS (view);
+
+ g_assert (class->get_local_only != NULL);
+ return class->get_local_only (view);
+}
+
+void
+gtk_places_view_set_local_only (GtkPlacesView *view,
+ gboolean local_only)
+{
+ GtkPlacesViewClass *class;
+
+ g_return_if_fail (GTK_IS_PLACES_VIEW (view));
+
+ class = GTK_PLACES_VIEW_GET_CLASS (view);
+
+ g_assert (class->get_local_only != NULL);
+ class->set_local_only (view, local_only);
}
diff --git a/gtk/gtkplacesview.h b/gtk/gtkplacesview.h
index 4922e4d..45d728f 100644
--- a/gtk/gtkplacesview.h
+++ b/gtk/gtkplacesview.h
@@ -17,15 +17,14 @@
*/
-#ifndef GTKPLACESVIEW_H
-#define GTKPLACESVIEW_H
+#ifndef GTK_PLACES_VIEW_H
+#define GTK_PLACES_VIEW_H
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkbox.h>
-#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
@@ -33,7 +32,7 @@ G_BEGIN_DECLS
#define GTK_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PLACES_VIEW,
GtkPlacesView))
#define GTK_PLACES_VIEW_CLASS(klass)(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PLACES_VIEW,
GtkPlacesViewClass))
#define GTK_IS_PLACES_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PLACES_VIEW))
-#define GTK_IS_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PLACES_VUEW))
+#define GTK_IS_PLACES_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PLACES_VIEW))
#define GTK_PLACES_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PLACES_VIEW,
GtkPlacesViewClass))
typedef struct _GtkPlacesView GtkPlacesView;
@@ -44,6 +43,10 @@ struct _GtkPlacesViewClass
{
GtkBoxClass parent_class;
+ gboolean (* get_local_only) (GtkPlacesView *view);
+ void (* set_local_only) (GtkPlacesView *view,
+ gboolean local_only);
+
/*< private >*/
/* Padding for future expansion */
@@ -63,8 +66,15 @@ GDK_AVAILABLE_IN_3_18
GType gtk_places_view_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_18
+gboolean gtk_places_view_get_local_only (GtkPlacesView *view);
+
+GDK_AVAILABLE_IN_3_18
+void gtk_places_view_set_local_only (GtkPlacesView *view,
+ gboolean local_only);
+
+GDK_AVAILABLE_IN_3_18
GtkWidget * gtk_places_view_new (void);
G_END_DECLS
-#endif /* GTKPLACESVIEW_H */
+#endif /* GTK_PLACES_VIEW_H */
diff --git a/gtk/ui/gtkplacesview.ui b/gtk/ui/gtkplacesview.ui
index 08c2968..7179333 100644
--- a/gtk/ui/gtkplacesview.ui
+++ b/gtk/ui/gtkplacesview.ui
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkPopover" id="recent_servers_popover">
@@ -86,8 +85,8 @@
<object class="GtkLabel" id="drives_title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</property>
+ <property name="margin_start">12</property>
+ <property name="margin_end">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes"><b>This Computer</b></property>
@@ -139,7 +138,7 @@
<object class="GtkLabel" id="network_title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">12</property>
+ <property name="margin_start">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="hexpand">False</property>
@@ -222,21 +221,16 @@
<property name="label" translatable="yes"><b>Connect to Server</b></property>
<property name="use_markup">True</property>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkLabel" id="address_label">
+ <object class="GtkButton" id="connect_button">
+ <property name="label" translatable="yes">Connect</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Address</property>
- <property name="xalign">1</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">3</property>
</packing>
</child>
<child>
@@ -254,7 +248,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -275,7 +268,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<style>
@@ -284,19 +276,18 @@
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="connect_button">
- <property name="label" translatable="yes">Connect</property>
+ <object class="GtkLabel" id="address_label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Address</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]