Пример #1
0
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));
}
Пример #2
0
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);
}
Пример #3
0
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;
}