bool call_history_view_gtk_populate_menu_for_selected (CallHistoryViewGtk* self, Ekiga::MenuBuilder &builder) { g_return_val_if_fail (IS_CALL_HISTORY_VIEW_GTK (self), false); bool result = false; GtkTreeSelection* selection = NULL; GtkTreeModel* model = NULL; GtkTreeIter iter; selection = gtk_tree_view_get_selection (self->priv->tree); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { Ekiga::Contact *contact = NULL; gtk_tree_model_get (model, &iter, COLUMN_CONTACT, &contact, -1); if (contact) result = contact->populate_menu (builder); } return result; }
static void on_map_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data) { GtkTreeSelection *selection = NULL; g_return_if_fail (IS_CALL_HISTORY_VIEW_GTK (data)); CallHistoryViewGtk *self = CALL_HISTORY_VIEW_GTK (data); selection = gtk_tree_view_get_selection (self->priv->tree); on_selection_changed (selection, self); }
void call_history_view_gtk_get_selected (CallHistoryViewGtk* self, History::Contact** contact) { g_return_if_fail (IS_CALL_HISTORY_VIEW_GTK (self) && contact != NULL); GtkTreeSelection* selection = NULL; GtkTreeModel* model = NULL; GtkTreeIter iter; selection = gtk_tree_view_get_selection (self->priv->tree); if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COLUMN_CONTACT, contact, -1); else *contact = NULL; }
static void on_book_cleared (CallHistoryViewGtk* data) { GtkListStore *store = NULL; GtkTreeSelection *selection = NULL; g_return_if_fail (IS_CALL_HISTORY_VIEW_GTK (data)); CallHistoryViewGtk *self = CALL_HISTORY_VIEW_GTK (data); store = GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tree)); selection = gtk_tree_view_get_selection (self->priv->tree); /* Reset old data. This also ensures GIO actions are * properly removed before adding new ones. */ self->priv->contact_menu.reset (); if (selection) g_signal_handlers_block_by_func (selection, (gpointer) on_selection_changed, self); gtk_list_store_clear (store); if (selection) g_signal_handlers_unblock_by_func (selection, (gpointer) on_selection_changed, self); }