static void on_clicked_show_presentity_menu (HeapView* self, Ekiga::Presentity* presentity, GdkEventButton* event) { Ekiga::TemporaryMenuBuilder temp; MenuBuilderGtk builder; self->priv->heap->populate_menu (temp); presentity->populate_menu (builder); if (!temp.empty ()) { builder.add_separator (); temp.populate_menu (builder); } if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); } g_object_ref_sink (builder.menu); g_object_unref (builder.menu); }
static void on_clicked_show_presentity_menu (Ekiga::Heap* heap, Ekiga::Presentity* presentity, GdkEventButton* event) { Ekiga::TemporaryMenuBuilder temp; MenuBuilderGtk builder; heap->populate_menu (temp); presentity->populate_menu (builder); if (!temp.empty ()) { builder.add_separator (); temp.populate_menu (builder); } if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); g_signal_connect (builder.menu, "hide", G_CALLBACK (g_object_unref), (gpointer) builder.menu); } g_object_ref_sink (G_OBJECT (builder.menu)); }
/* react to user clicks */ static gint on_clicked (GtkWidget *tree, GdkEventButton *event, gpointer data) { History::Book *book = NULL; GtkTreeModel *model = NULL; GtkTreePath *path = NULL; GtkTreeIter iter; Ekiga::Contact *contact = NULL; book = (History::Book*)data; model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree)); if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) { if (gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_model_get (model, &iter, COLUMN_CONTACT, &contact, -1); if (event->type == GDK_BUTTON_PRESS && event->button == 3) { MenuBuilderGtk builder; if (contact != NULL) contact->populate_menu (builder); if (!builder.empty()) builder.add_separator (); builder.add_action ("gtk-clear", _("Clear List"), boost::bind (&History::Book::clear, book)); gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); g_object_ref_sink (builder.menu); } if (event->type == GDK_2BUTTON_PRESS) { if (contact != NULL) { Ekiga::TriggerMenuBuilder builder; contact->populate_menu (builder); } } } gtk_tree_path_free (path); } return TRUE; }
/* Implementation of the helpers */ static void on_clicked_show_heap_menu (Ekiga::Heap* heap, GdkEventButton* event) { MenuBuilderGtk builder; heap->populate_menu (builder); if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); g_signal_connect (builder.menu, "hide", G_CALLBACK (g_object_unref), (gpointer) builder.menu); } g_object_ref_sink (G_OBJECT (builder.menu)); }
static void on_clicked_show_group_menu (HeapView* self, const gchar* name, GdkEventButton* event) { MenuBuilderGtk builder; self->priv->heap->populate_menu_for_group (name, builder); if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); } g_object_ref_sink (builder.menu); g_object_unref (builder.menu); }
static gint on_contact_clicked (GtkWidget *tree_view, GdkEventButton *event, gpointer data) { GtkTreePath *path = NULL; GtkTreeIter iter; GtkTreeModel *model = NULL; if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) { model = gtk_tree_view_get_model (BOOK_VIEW_GTK (data)->priv->tree_view); if (gtk_tree_model_get_iter (model, &iter, path)) { Ekiga::Contact *contact = NULL; gtk_tree_model_get (model, &iter, COLUMN_CONTACT_POINTER, &contact, -1); if (contact != NULL) { if (event->type == GDK_BUTTON_PRESS && event->button == 3) { Ekiga::TemporaryMenuBuilder temp; MenuBuilderGtk builder; BOOK_VIEW_GTK (data)->priv->book->populate_menu (temp); contact->populate_menu (builder); if (!temp.empty ()) { builder.add_separator (); temp.populate_menu (builder); } if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); g_signal_connect (builder.menu, "hide", G_CALLBACK (g_object_unref), (gpointer) builder.menu); } g_object_ref_sink (G_OBJECT (builder.menu)); } else if (event->type == GDK_2BUTTON_PRESS) { Ekiga::TriggerMenuBuilder builder; contact->populate_menu (builder); } } } gtk_tree_path_free (path); } return TRUE; }
/* GTK+ Callbacks */ static gint account_clicked_cb (G_GNUC_UNUSED GtkWidget *w, GdkEventButton *event, gpointer data) { AccountsWindow *self = ACCOUNTS_WINDOW (data); GtkTreePath *path = NULL; GtkTreeView *tree_view = NULL; GtkTreeModel *model = NULL; GtkTreeIter iter; Ekiga::Account *account = NULL; tree_view = GTK_TREE_VIEW (self->priv->accounts_list); model = gtk_tree_view_get_model (tree_view); if (event->type == GDK_BUTTON_PRESS || event->type == GDK_KEY_PRESS || event->type == GDK_2BUTTON_PRESS) { if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL)) { if (gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_model_get (model, &iter, COLUMN_ACCOUNT, &account, -1); gtk_tree_path_free (path); } } } if (account == NULL) return FALSE; if (event->type == GDK_BUTTON_PRESS || event->type == GDK_KEY_PRESS) { populate_menu (GTK_WIDGET (data)); if (event->button == 3) { MenuBuilderGtk builder; account->populate_menu (builder); if (!builder.empty ()) { gtk_widget_show_all (builder.menu); gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL, NULL, NULL, event->button, event->time); g_signal_connect (builder.menu, "hide", G_CALLBACK (g_object_unref), (gpointer) builder.menu); } g_object_ref_sink (G_OBJECT (builder.menu)); } } else if (event->type == GDK_2BUTTON_PRESS) { Ekiga::TriggerMenuBuilder builder; account->populate_menu (builder); } return TRUE; }