aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat.c2
-rw-r--r--libempathy-gtk/empathy-individual-menu.c36
-rw-r--r--libempathy-gtk/empathy-individual-menu.h1
-rw-r--r--libempathy-gtk/empathy-individual-view.c4
-rw-r--r--libempathy-gtk/empathy-roster-view.c7
5 files changed, 44 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 63364b3a2..e0460e527 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -4295,7 +4295,7 @@ empathy_chat_get_contact_menu (EmpathyChat *chat)
if (individual == NULL)
return NULL;
- menu = empathy_individual_menu_new (individual,
+ menu = empathy_individual_menu_new (individual, NULL,
EMPATHY_INDIVIDUAL_FEATURE_CALL |
EMPATHY_INDIVIDUAL_FEATURE_LOG |
EMPATHY_INDIVIDUAL_FEATURE_INFO |
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index e70146bf7..8f6334750 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -49,13 +49,15 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIndividualMenu)
typedef struct {
+ gchar *active_group; /* may be NULL */
FolksIndividual *individual; /* owned */
EmpathyIndividualFeatureFlags features;
EmpathyIndividualStore *store; /* may be NULL */
} EmpathyIndividualMenuPriv;
enum {
- PROP_INDIVIDUAL = 1,
+ PROP_ACTIVE_GROUP = 1,
+ PROP_INDIVIDUAL,
PROP_FEATURES,
PROP_STORE,
};
@@ -1038,6 +1040,9 @@ get_property (GObject *object,
switch (param_id)
{
+ case PROP_ACTIVE_GROUP:
+ g_value_set_string (value, priv->active_group);
+ break;
case PROP_INDIVIDUAL:
g_value_set_object (value, priv->individual);
break;
@@ -1065,6 +1070,10 @@ set_property (GObject *object,
switch (param_id)
{
+ case PROP_ACTIVE_GROUP:
+ g_assert (priv->active_group == NULL); /* construct only */
+ priv->active_group = g_value_dup_string (value);
+ break;
case PROP_INDIVIDUAL:
priv->individual = g_value_dup_object (value);
break;
@@ -1092,6 +1101,16 @@ dispose (GObject *object)
}
static void
+finalize (GObject *object)
+{
+ EmpathyIndividualMenuPriv *priv = GET_PRIV (object);
+
+ g_free (priv->active_group);
+
+ G_OBJECT_CLASS (empathy_individual_menu_parent_class)->finalize (object);
+}
+
+static void
empathy_individual_menu_class_init (EmpathyIndividualMenuClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1100,6 +1119,19 @@ empathy_individual_menu_class_init (EmpathyIndividualMenuClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->dispose = dispose;
+ object_class->finalize = finalize;
+
+ /**
+ * gchar *:active-group:
+ *
+ * The group the selected roster-contact widget belongs, or NULL.
+ */
+ g_object_class_install_property (object_class, PROP_ACTIVE_GROUP,
+ g_param_spec_string ("active-group",
+ "Active group",
+ "The group the selected roster-contact widget belongs, or NULL",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* EmpathyIndividualMenu:individual:
@@ -1138,6 +1170,7 @@ empathy_individual_menu_class_init (EmpathyIndividualMenuClass *klass)
GtkWidget *
empathy_individual_menu_new (FolksIndividual *individual,
+ const gchar *active_group,
EmpathyIndividualFeatureFlags features,
EmpathyIndividualStore *store)
{
@@ -1147,6 +1180,7 @@ empathy_individual_menu_new (FolksIndividual *individual,
g_return_val_if_fail (features != EMPATHY_INDIVIDUAL_FEATURE_NONE, NULL);
return g_object_new (EMPATHY_TYPE_INDIVIDUAL_MENU,
+ "active-group", active_group,
"individual", individual,
"features", features,
"store", store,
diff --git a/libempathy-gtk/empathy-individual-menu.h b/libempathy-gtk/empathy-individual-menu.h
index 41e289f91..34ed60a3c 100644
--- a/libempathy-gtk/empathy-individual-menu.h
+++ b/libempathy-gtk/empathy-individual-menu.h
@@ -72,6 +72,7 @@ typedef struct {
GType empathy_individual_menu_get_type (void) G_GNUC_CONST;
GtkWidget * empathy_individual_menu_new (FolksIndividual *individual,
+ const gchar *active_group,
EmpathyIndividualFeatureFlags features,
EmpathyIndividualStore *store);
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 87fa3d966..d0a367df2 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -2472,8 +2472,8 @@ empathy_individual_view_get_individual_menu (EmpathyIndividualView *view)
if (!empathy_folks_individual_contains_contact (individual))
goto out;
- menu = empathy_individual_menu_new (individual, priv->individual_features,
- priv->store);
+ menu = empathy_individual_menu_new (individual, NULL,
+ priv->individual_features, priv->store);
out:
g_object_unref (individual);
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 93b5d0e53..7d168d471 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -1146,6 +1146,7 @@ fire_popup_individual_menu (EmpathyRosterView *self,
{
EmpathyRosterContact *contact;
FolksIndividual *individual;
+ const gchar *active_group;
if (!EMPATHY_IS_ROSTER_CONTACT (child))
return;
@@ -1153,8 +1154,9 @@ fire_popup_individual_menu (EmpathyRosterView *self,
contact = EMPATHY_ROSTER_CONTACT (child);
individual = empathy_roster_contact_get_individual (contact);
+ active_group = empathy_roster_contact_get_group (contact);
g_signal_emit (self, signals[SIG_POPUP_INDIVIDUAL_MENU], 0,
- individual, button, time);
+ active_group, individual, button, time);
}
static gboolean
@@ -1347,7 +1349,8 @@ empathy_roster_view_class_init (
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE,
- 3, FOLKS_TYPE_INDIVIDUAL, G_TYPE_UINT, G_TYPE_UINT);
+ 4, G_TYPE_STRING, FOLKS_TYPE_INDIVIDUAL, G_TYPE_UINT,
+ G_TYPE_UINT);
signals[SIG_EVENT_ACTIVATED] = g_signal_new ("event-activated",
G_OBJECT_CLASS_TYPE (klass),