aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-24 21:57:56 +0800
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-27 17:23:49 +0800
commit1337c4e6f42da41d1da84f32586f33812b8ec2b5 (patch)
treefa81e37043bd129e3610002c253935dd524e03ce /libempathy-gtk
parent5e9eff1788ca0344be6cb09a304a89add7002248 (diff)
downloadgsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar.gz
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar.bz2
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar.lz
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar.xz
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.tar.zst
gsoc2013-empathy-1337c4e6f42da41d1da84f32586f33812b8ec2b5.zip
Add feature support for EmpathyPersonaView
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-linker.c3
-rw-r--r--libempathy-gtk/empathy-persona-view.c43
-rw-r--r--libempathy-gtk/empathy-persona-view.h9
3 files changed, 51 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-individual-linker.c b/libempathy-gtk/empathy-individual-linker.c
index 9ebb4718b..272979046 100644
--- a/libempathy-gtk/empathy-individual-linker.c
+++ b/libempathy-gtk/empathy-individual-linker.c
@@ -322,7 +322,8 @@ set_up (EmpathyIndividualLinker *self)
priv->persona_store = empathy_persona_store_new (priv->new_individual);
empathy_persona_store_set_show_protocols (priv->persona_store, TRUE);
- persona_view = empathy_persona_view_new (priv->persona_store);
+ persona_view = empathy_persona_view_new (priv->persona_store,
+ EMPATHY_PERSONA_VIEW_FEATURE_NONE);
empathy_persona_view_set_show_offline (persona_view, TRUE);
gtk_container_add (GTK_CONTAINER (scrolled_window),
diff --git a/libempathy-gtk/empathy-persona-view.c b/libempathy-gtk/empathy-persona-view.c
index 04777b1b6..44ea8256a 100644
--- a/libempathy-gtk/empathy-persona-view.c
+++ b/libempathy-gtk/empathy-persona-view.c
@@ -44,6 +44,7 @@
#include "empathy-images.h"
#include "empathy-cell-renderer-text.h"
#include "empathy-cell-renderer-activatable.h"
+#include "empathy-gtk-enum-types.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include <libempathy/empathy-debug.h>
@@ -69,6 +70,7 @@ typedef struct
GtkTreeModelFilter *filter;
GtkWidget *tooltip_widget;
gboolean show_offline;
+ EmpathyPersonaViewFeatureFlags features;
} EmpathyPersonaViewPriv;
enum
@@ -76,6 +78,7 @@ enum
PROP_0,
PROP_MODEL,
PROP_SHOW_OFFLINE,
+ PROP_FEATURES,
};
G_DEFINE_TYPE (EmpathyPersonaView, empathy_persona_view, GTK_TYPE_TREE_VIEW);
@@ -312,6 +315,17 @@ text_cell_data_func (GtkTreeViewColumn *tree_column,
}
static void
+set_features (EmpathyPersonaView *self,
+ EmpathyPersonaViewFeatureFlags features)
+{
+ EmpathyPersonaViewPriv *priv = GET_PRIV (self);
+
+ priv->features = features;
+
+ g_object_notify (G_OBJECT (self), "features");
+}
+
+static void
empathy_persona_view_init (EmpathyPersonaView *self)
{
EmpathyPersonaViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
@@ -411,6 +425,9 @@ get_property (GObject *object,
case PROP_SHOW_OFFLINE:
g_value_set_boolean (value, priv->show_offline);
break;
+ case PROP_FEATURES:
+ g_value_set_flags (value, priv->features);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -434,6 +451,9 @@ set_property (GObject *object,
empathy_persona_view_set_show_offline (self,
g_value_get_boolean (value));
break;
+ case PROP_FEATURES:
+ set_features (self, g_value_get_flags (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -481,12 +501,27 @@ empathy_persona_view_class_init (EmpathyPersonaViewClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * EmpathyPersonaStore:features:
+ *
+ * Features of the view, such as whether drag and drop is enabled.
+ */
+ g_object_class_install_property (object_class, PROP_FEATURES,
+ g_param_spec_flags ("features",
+ "Features",
+ "Flags for all enabled features.",
+ EMPATHY_TYPE_PERSONA_VIEW_FEATURE_FLAGS,
+ EMPATHY_PERSONA_VIEW_FEATURE_NONE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_type_class_add_private (object_class, sizeof (EmpathyPersonaViewPriv));
}
/**
* empathy_persona_view_new:
* @store: an #EmpathyPersonaStore
+ * @features: a set of flags specifying the view's functionality, or
+ * %EMPATHY_PERSONA_VIEW_FEATURE_NONE
*
* Create a new #EmpathyPersonaView displaying the personas in
* #EmpathyPersonaStore.
@@ -494,11 +529,15 @@ empathy_persona_view_class_init (EmpathyPersonaViewClass *klass)
* Return value: a new #EmpathyPersonaView
*/
EmpathyPersonaView *
-empathy_persona_view_new (EmpathyPersonaStore *store)
+empathy_persona_view_new (EmpathyPersonaStore *store,
+ EmpathyPersonaViewFeatureFlags features)
{
g_return_val_if_fail (EMPATHY_IS_PERSONA_STORE (store), NULL);
- return g_object_new (EMPATHY_TYPE_PERSONA_VIEW, "model", store, NULL);
+ return g_object_new (EMPATHY_TYPE_PERSONA_VIEW,
+ "model", store,
+ "features", features,
+ NULL);
}
/**
diff --git a/libempathy-gtk/empathy-persona-view.h b/libempathy-gtk/empathy-persona-view.h
index 11fe039eb..c7ba61d05 100644
--- a/libempathy-gtk/empathy-persona-view.h
+++ b/libempathy-gtk/empathy-persona-view.h
@@ -36,6 +36,12 @@
G_BEGIN_DECLS
+typedef enum
+{
+ EMPATHY_PERSONA_VIEW_FEATURE_NONE = 0,
+ EMPATHY_PERSONA_VIEW_FEATURE_ALL = (1 << 0) - 1,
+} EmpathyPersonaViewFeatureFlags;
+
#define EMPATHY_TYPE_PERSONA_VIEW (empathy_persona_view_get_type ())
#define EMPATHY_PERSONA_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
EMPATHY_TYPE_PERSONA_VIEW, EmpathyPersonaView))
@@ -61,7 +67,8 @@ typedef struct
GType empathy_persona_view_get_type (void) G_GNUC_CONST;
-EmpathyPersonaView *empathy_persona_view_new (EmpathyPersonaStore *store);
+EmpathyPersonaView *empathy_persona_view_new (EmpathyPersonaStore *store,
+ EmpathyPersonaViewFeatureFlags features);
FolksPersona *empathy_persona_view_dup_selected (EmpathyPersonaView *self);