static void _combo_index_changed (AnerleyPresenceChooser *self, GParamSpec *pspec, gpointer user_data) { AnerleyPresenceChooserPrivate *priv = GET_PRIVATE (self); MxComboBox *combo = MX_COMBO_BOX (self); gint index = mx_combo_box_get_index (combo); ComboEntry *entry; gchar *message; if (index >= 0) entry = &g_array_index (priv->combo_entries, ComboEntry, index); else return; priv->presence = entry->presence; /* Get current message to not modify it */ tp_account_manager_get_most_available_presence (priv->am, NULL, &message); tp_account_manager_set_all_requested_presences (priv->am, entry->presence, presences[entry->presence].status, message); g_free (message); }
static void sort_by_index_changed_cb (MxComboBox *combo, GParamSpec *pspec, MnbPeoplePanel *self) { MnbPeoplePanelPrivate *priv = GET_PRIVATE (self); gint index = mx_combo_box_get_index (combo); if (index == 1) anerley_feed_model_set_sort_method (priv->model, ANERLEY_FEED_MODEL_SORT_METHOD_PRESENCE); else if (index == 2) anerley_feed_model_set_sort_method (priv->model, ANERLEY_FEED_MODEL_SORT_METHOD_NAME); else if (index == 4) anerley_feed_model_set_show_offline (priv->model, FALSE); else if (index == 5) anerley_feed_model_set_show_offline (priv->model, TRUE); }
static void new_index_changed_cb (MxComboBox *combo, GParamSpec *pspec, MnbPeoplePanel *self) { MnbPeoplePanelPrivate *priv = GET_PRIVATE (self); gint index = mx_combo_box_get_index (combo); GDesktopAppInfo *app_info; GError *error = NULL; const gchar *args[4] = { NULL, }; const gchar *option; if (index == 0) option = "--new-contact"; else if (index == 1) option = "--join-chatroom"; else return; app_info = g_desktop_app_info_new ("empathy.desktop"); args[0] = g_app_info_get_commandline (G_APP_INFO (app_info)); args[1] = "--start-hidden"; args[2] = option; args[3] = NULL; if (!g_spawn_async (NULL, (gchar **)args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) { g_warning (G_STRLOC ": Error starting empathy: %s", error->message); g_clear_error (&error); } else { if (priv->panel_client) mpl_panel_client_hide (priv->panel_client); } g_object_unref (app_info); }