Exemplo n.º 1
0
static void
on_book_selection_changed (GtkTreeSelection *selection,
                           gpointer data)
{
  AddressBookWindow *self = NULL;
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;
  GtkWidget *view = NULL;
  gint page = -1;
  GtkWidget *menu = NULL;

  self = ADDRESSBOOK_WINDOW (data);

  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {

    gtk_tree_model_get (model, &iter, COLUMN_VIEW, &view, -1);
    page = gtk_notebook_page_num (GTK_NOTEBOOK (self->priv->notebook), view);
    gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv-> notebook), page);

    menu = gtk_menu_new ();
    book_view_gtk_populate_menu (BOOK_VIEW_GTK (view), menu);
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (self->priv-> menu_item_view),
                               menu);
    gtk_widget_show_all (menu);
    gtk_widget_set_sensitive (self->priv->menu_item_view, TRUE);
    g_object_unref (view);
  } 
  else {

    gtk_widget_set_sensitive (self->priv->menu_item_view, FALSE);
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (self->priv->menu_item_view), NULL);
  }
}
Exemplo n.º 2
0
static void
on_button_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
                      gpointer data)
{
  g_return_if_fail (data != NULL);

  gtk_widget_activate (GTK_WIDGET (BOOK_VIEW_GTK (data)->priv->entry));
}
Exemplo n.º 3
0
static void
on_contact_removed (Ekiga::ContactPtr contact,
		    gpointer data)
{
  BookViewGtk *view = NULL;

  view = BOOK_VIEW_GTK (data);
  book_view_gtk_remove_contact (view, contact);
}
Exemplo n.º 4
0
static void
book_view_gtk_finalize (GObject *obj)
{
  BookViewGtk *view = NULL;

  view = BOOK_VIEW_GTK (obj);

  delete view->priv;

  G_OBJECT_CLASS (book_view_gtk_parent_class)->finalize (obj);
}
Exemplo n.º 5
0
static void
on_contact_updated (Ekiga::ContactPtr contact,
		    gpointer data)
{
  BookViewGtk *view = NULL;
  GtkTreeIter iter;

  view = BOOK_VIEW_GTK (data);

  if (book_view_gtk_find_iter_for_contact (view, contact, &iter)) {
    book_view_gtk_update_contact (view, contact, &iter);
  }
}
Exemplo n.º 6
0
static void
on_updated (gpointer data)
{
  BookViewGtk *view = NULL;

  view = BOOK_VIEW_GTK (data);

  std::string status = view->priv->book->get_status ();

  gtk_statusbar_pop (GTK_STATUSBAR (view->priv->statusbar), 0);
  gtk_statusbar_push (GTK_STATUSBAR (view->priv->statusbar), 0, status.c_str ());

  boost::shared_ptr<Ekiga::Filterable> filtered = boost::dynamic_pointer_cast<Ekiga::Filterable>(view->priv->book);
  if (filtered) {

    gtk_entry_set_text (GTK_ENTRY (view->priv->entry),
			filtered->get_search_filter ().c_str ());
  }
}
Exemplo n.º 7
0
/* GObject boilerplate code */
static void
book_view_gtk_dispose (GObject *obj)
{
  BookViewGtk *view = NULL;

  view = BOOK_VIEW_GTK (obj);

  if (view->priv->tree_view) {

    g_signal_handlers_disconnect_matched (gtk_tree_view_get_selection (view->priv->tree_view),
					  (GSignalMatchType) G_SIGNAL_MATCH_DATA,
					  0, /* signal_id */
					  (GQuark) 0, /* detail */
					  NULL,	/* closure */
					  NULL,	/* func */
					  view); /* data */
    gtk_list_store_clear (GTK_LIST_STORE (gtk_tree_view_get_model (view->priv->tree_view)));

    view->priv->tree_view = NULL;
  }

  G_OBJECT_CLASS (book_view_gtk_parent_class)->dispose (obj);
}
Exemplo n.º 8
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;
}
Exemplo n.º 9
0
static void
on_entry_activated_cb (GtkWidget *entry,
                       gpointer data)
{
  const char *entry_text = gtk_entry_get_text (GTK_ENTRY (entry));

  boost::shared_ptr<Ekiga::Filterable> filtered = boost::dynamic_pointer_cast<Ekiga::Filterable>(BOOK_VIEW_GTK (data)->priv->book);

  filtered->set_search_filter (entry_text);
}
Exemplo n.º 10
0
static void
on_contact_added (Ekiga::ContactPtr contact,
		  gpointer data)
{
  book_view_gtk_add_contact (BOOK_VIEW_GTK (data), contact);
}