aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-presence-chooser.c
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-11 00:53:21 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-11 00:53:21 +0800
commit99a64c4c995a5c788b86355824c4cfcfb53ca76f (patch)
tree8fb8d33b5abf5d908eaf3d2fd62c30671a00035e /libempathy-gtk/empathy-presence-chooser.c
parentdb394d1bfc315ee69d735c94ce7a6e8f33541291 (diff)
downloadgsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar.gz
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar.bz2
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar.lz
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar.xz
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.tar.zst
gsoc2013-empathy-99a64c4c995a5c788b86355824c4cfcfb53ca76f.zip
Initial work on reimplementing presence_chooser_presence_changed_cb
From: Davyd Madeley <davyd@madeley.id.au> svn path=/trunk/; revision=2771
Diffstat (limited to 'libempathy-gtk/empathy-presence-chooser.c')
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c67
1 files changed, 61 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index b0f3f8e51..0b151d56d 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -393,13 +393,11 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
// FIXME - no!
gtk_combo_box_set_active (GTK_COMBO_BOX (chooser), 0);
-#if 0
priv->idle = empathy_idle_dup_singleton ();
presence_chooser_presence_changed_cb (chooser);
g_signal_connect_swapped (priv->idle, "notify",
G_CALLBACK (presence_chooser_presence_changed_cb),
chooser);
-#endif
}
static void
@@ -438,27 +436,84 @@ empathy_presence_chooser_new (void)
static void
presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
{
-#if 0
EmpathyPresenceChooserPriv *priv;
McPresence state;
McPresence flash_state;
const gchar *status;
+ g_print (" > presence_chooser_presence_changed_cb\n");
+
priv = GET_PRIV (chooser);
state = empathy_idle_get_state (priv->idle);
status = empathy_idle_get_status (priv->idle);
flash_state = empathy_idle_get_flash_state (priv->idle);
- presence_chooser_reset_scroll_timeout (chooser);
- gtk_label_set_text (GTK_LABEL (priv->label), status);
+ g_print ("status = %s\n", status);
+
+ // FIXME - we need to either find an entry in the model or add one
+ GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (chooser));
+ GtkTreeIter iter;
+ gboolean valid, match_state = FALSE, match = FALSE;
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next (model, &iter))
+ {
+ int m_type;
+ McPresence m_state;
+ char *m_status;
+
+ gtk_tree_model_get (model, &iter,
+ COL_STATE, &m_state,
+ COL_TYPE, &m_type,
+ -1);
+
+ if (m_type == ENTRY_TYPE_CUSTOM)
+ {
+ continue;
+ }
+ else if (!match_state && state == m_state)
+ {
+ /* we are now in the section that can contain our
+ * match */
+ match_state = TRUE;
+ }
+ else if (match_state && state != m_state)
+ {
+ /* we have passed the section that can contain our
+ * match */
+ break;
+ }
+
+ gtk_tree_model_get (model, &iter,
+ COL_STATUS_TEXT, &m_status,
+ -1);
+
+ match = !strcmp (status, m_status);
+
+ g_free (m_status);
+
+ if (match) break;
+
+ }
+
+ if (match)
+ {
+ g_print ("GOT MATCH\n");
+ }
+ else
+ {
+ g_print ("NO MATCH\n");
+ }
+
+ //presence_chooser_reset_scroll_timeout (chooser);
+ //gtk_label_set_text (GTK_LABEL (priv->label), status);
if (flash_state != MC_PRESENCE_UNSET) {
presence_chooser_flash_start (chooser, state, flash_state);
} else {
presence_chooser_flash_stop (chooser, state);
}
-#endif
}
#if 0