ekiga r7323 - trunk/lib/engine/gui/gtk-frontend
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7323 - trunk/lib/engine/gui/gtk-frontend
- Date: Mon, 10 Nov 2008 21:35:59 +0000 (UTC)
Author: jpuydt
Date: Mon Nov 10 21:35:59 2008
New Revision: 7323
URL: http://svn.gnome.org/viewvc/ekiga?rev=7323&view=rev
Log:
Made the GUI presence code use gmref_ptr too
Modified:
trunk/lib/engine/gui/gtk-frontend/presentity-view.cpp
trunk/lib/engine/gui/gtk-frontend/presentity-view.h
trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
Modified: trunk/lib/engine/gui/gtk-frontend/presentity-view.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/presentity-view.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/presentity-view.cpp Mon Nov 10 21:35:59 2008
@@ -41,7 +41,7 @@
struct _PresentityViewPrivate
{
- Ekiga::Presentity* presentity;
+ gmref_ptr<Ekiga::Presentity> presentity;
sigc::connection updated_conn;
sigc::connection removed_conn;
@@ -66,7 +66,7 @@
/* declaration of internal api */
static void presentity_view_set_presentity (PresentityView* self,
- Ekiga::Presentity* presentity);
+ gmref_ptr<Ekiga::Presentity> presentity);
static void presentity_view_unset_presentity (PresentityView* self);
@@ -105,9 +105,9 @@
static void
presentity_view_set_presentity (PresentityView* self,
- Ekiga::Presentity* presentity)
+ gmref_ptr<Ekiga::Presentity> presentity)
{
- g_return_if_fail (self->priv->presentity == NULL);
+ g_return_if_fail ( !self->priv->presentity);
self->priv->presentity = presentity;
self->priv->updated_conn = self->priv->presentity->updated.connect (sigc::bind (sigc::ptr_fun (on_presentity_updated), self));
@@ -200,7 +200,6 @@
self = (PresentityView*)instance;
self->priv = new PresentityViewPrivate;
- self->priv->presentity = NULL;
self->priv->presence_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (self), self->priv->presence_image,
@@ -250,9 +249,9 @@
/* public api */
GtkWidget*
-presentity_view_new (Ekiga::Presentity& presentity)
+presentity_view_new (gmref_ptr<Ekiga::Presentity> presentity)
{
return (GtkWidget*)g_object_new (TYPE_PRESENTITY_VIEW,
- "presentity", &presentity,
+ "presentity", &*presentity,
NULL);
}
Modified: trunk/lib/engine/gui/gtk-frontend/presentity-view.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/presentity-view.h (original)
+++ trunk/lib/engine/gui/gtk-frontend/presentity-view.h Mon Nov 10 21:35:59 2008
@@ -62,7 +62,7 @@
/* public api */
-GtkWidget *presentity_view_new (Ekiga::Presentity& presentity);
+GtkWidget *presentity_view_new (gmref_ptr<Ekiga::Presentity> presentity);
/* GObject thingies */
Modified: trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp Mon Nov 10 21:35:59 2008
@@ -39,6 +39,7 @@
#include <iostream>
#include <vector>
+#include "gm-refcounted-boxed.h"
#include "gm-cell-renderer-bitext.h"
#include "gmcellrendererexpander.h"
#include "gmstockicons.h"
@@ -140,20 +141,20 @@
/* DESCRIPTION : Set of functions called when the user clicks in a view
* BEHAVIOUR : Folds/unfolds, shows a menu or triggers default action
*/
-static void on_clicked_show_heap_menu (Ekiga::Heap* heap,
+static void on_clicked_show_heap_menu (gmref_ptr<Ekiga::Heap> heap,
GdkEventButton* event);
-static void on_clicked_show_heap_group_menu (Ekiga::Heap* heap,
+static void on_clicked_show_heap_group_menu (gmref_ptr<Ekiga::Heap> heap,
const std::string name,
GdkEventButton* event);
-static void on_clicked_show_presentity_menu (Ekiga::Heap* heap,
- Ekiga::Presentity* presentity,
+static void on_clicked_show_presentity_menu (gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
GdkEventButton* event);
static void on_clicked_fold (RosterViewGtk* self,
GtkTreePath* path,
const gchar* name);
-static void on_clicked_trigger_presentity (Ekiga::Presentity* presentity);
+static void on_clicked_trigger_presentity (gmref_ptr<Ekiga::Presentity> presentity);
/* DESCRIPTION : Called whenever a (online/total) count has to be updated
* BEHAVIOUR : Updates things...
@@ -238,7 +239,7 @@
* BEHAVIOR : Visits the cluster's heaps, and add them to the view
* PRE : /
*/
-static void on_cluster_added (Ekiga::Cluster &cluster,
+static void on_cluster_added (gmref_ptr<Ekiga::Cluster> cluster,
gpointer data);
@@ -246,24 +247,24 @@
* BEHAVIOR : Adds in the cluster heaps
* PRE : /
*/
-static bool visit_heaps (Ekiga::Heap &heap,
- Ekiga::Cluster *cluster,
+static bool visit_heaps (gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Cluster> cluster,
gpointer data);
/* DESCRIPTION : Called when the or heap_added signal has been emitted
* BEHAVIOR : Add or Update the Heap in the GtkTreeView.
* PRE : /
*/
-static void on_heap_added (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
+static void on_heap_added (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data);
/* DESCRIPTION : Called when the heap_updated signal has been emitted
* BEHAVIOR : Add or Update the Heap in the GtkTreeView.
* PRE : /
*/
-static void on_heap_updated (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
+static void on_heap_updated (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data);
@@ -274,8 +275,8 @@
* the view.
* PRE : /
*/
-static void on_heap_removed (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
+static void on_heap_removed (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data);
@@ -283,9 +284,9 @@
* BEHAVIOR : Adds in the heap presentities
* PRE : /
*/
-static bool visit_presentities (Ekiga::Presentity &presentity,
- Ekiga::Cluster *cluster,
- Ekiga::Heap *heap,
+static bool visit_presentities (gmref_ptr<Ekiga::Presentity> presentity,
+ gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data);
@@ -295,9 +296,9 @@
* added.
* PRE : A valid Heap.
*/
-static void on_presentity_added (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+static void on_presentity_added (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data);
@@ -306,9 +307,9 @@
* BEHAVIOR : Update the given Presentity into the Heap.
* PRE : A valid Heap.
*/
-static void on_presentity_updated (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+static void on_presentity_updated (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data);
@@ -317,9 +318,9 @@
* BEHAVIOR : Remove the given Presentity from the given Heap.
* PRE : A valid Heap.
*/
-static void on_presentity_removed (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+static void on_presentity_removed (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data);
@@ -341,7 +342,7 @@
* PRE : /
*/
static void roster_view_gtk_find_iter_for_heap (RosterViewGtk *view,
- Ekiga::Heap &heap,
+ gmref_ptr<Ekiga::Heap> heap,
GtkTreeIter *iter);
@@ -352,7 +353,7 @@
* PRE : /
*/
static void roster_view_gtk_find_iter_for_group (RosterViewGtk *view,
- Ekiga::Heap& heap,
+ gmref_ptr<Ekiga::Heap> heap,
GtkTreeIter *heap_iter,
const std::string name,
GtkTreeIter *iter);
@@ -366,7 +367,7 @@
*/
static void roster_view_gtk_find_iter_for_presentity (RosterViewGtk *view,
GtkTreeIter *group_iter,
- Ekiga::Presentity &presentity,
+ gmref_ptr<Ekiga::Presentity> presentity,
GtkTreeIter *iter);
@@ -391,7 +392,7 @@
}
static void
-on_clicked_show_heap_menu (Ekiga::Heap* heap,
+on_clicked_show_heap_menu (gmref_ptr<Ekiga::Heap> heap,
GdkEventButton* event)
{
MenuBuilderGtk builder;
@@ -409,7 +410,7 @@
}
static void
-on_clicked_show_heap_group_menu (Ekiga::Heap* heap,
+on_clicked_show_heap_group_menu (gmref_ptr<Ekiga::Heap> heap,
const std::string name,
GdkEventButton* event)
{
@@ -428,8 +429,8 @@
}
static void
-on_clicked_show_presentity_menu (Ekiga::Heap* heap,
- Ekiga::Presentity* presentity,
+on_clicked_show_presentity_menu (gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
GdkEventButton* event)
{
Ekiga::TemporaryMenuBuilder temp;
@@ -493,7 +494,7 @@
}
static void
-on_clicked_trigger_presentity (Ekiga::Presentity* presentity)
+on_clicked_trigger_presentity (gmref_ptr<Ekiga::Presentity> presentity)
{
Ekiga::TriggerMenuBuilder builder;
@@ -526,6 +527,7 @@
&& (presentity->get_presence () == "offline"
|| presentity->get_presence () == "unknown"))
offline_count++;
+ gmref_dec (presentity);
} while (gtk_tree_model_iter_next (model, &loop_iter));
}
@@ -865,36 +867,36 @@
}
static void
-on_cluster_added (Ekiga::Cluster &cluster,
+on_cluster_added (gmref_ptr<Ekiga::Cluster> cluster,
gpointer data)
{
- cluster.visit_heaps (sigc::bind (sigc::ptr_fun (visit_heaps),
- &cluster, data));
+ cluster->visit_heaps (sigc::bind (sigc::ptr_fun (visit_heaps),
+ &*cluster, data));
}
static bool
-visit_heaps (Ekiga::Heap &heap,
- Ekiga::Cluster *cluster,
+visit_heaps (gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Cluster> cluster,
gpointer data)
{
- on_heap_updated (*cluster, heap, data);
- heap.visit_presentities (sigc::bind (sigc::ptr_fun (visit_presentities), cluster, &heap, data));
+ on_heap_updated (cluster, heap, data);
+ heap->visit_presentities (sigc::bind (sigc::ptr_fun (visit_presentities), cluster, heap, data));
return true;
}
static void
-on_heap_added (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
+on_heap_added (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data)
{
on_heap_updated (cluster, heap, data);
- heap.visit_presentities (sigc::bind (sigc::ptr_fun (visit_presentities), &cluster, &heap, data));
+ heap->visit_presentities (sigc::bind (sigc::ptr_fun (visit_presentities), cluster, heap, data));
}
static void
-on_heap_updated (Ekiga::Cluster &/*cluster*/,
- Ekiga::Heap &heap,
+on_heap_updated (gmref_ptr<Ekiga::Cluster> /*cluster*/,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data)
{
RosterViewGtk *self = ROSTER_VIEW_GTK (data);
@@ -904,16 +906,16 @@
gtk_tree_store_set (self->priv->store, &iter,
COLUMN_TYPE, TYPE_HEAP,
- COLUMN_HEAP, &heap,
- COLUMN_NAME, heap.get_name ().c_str (),
+ COLUMN_HEAP, &*heap,
+ COLUMN_NAME, heap->get_name ().c_str (),
-1);
gtk_tree_view_expand_all (self->priv->tree_view);
}
static void
-on_heap_removed (Ekiga::Cluster &/*cluster*/,
- Ekiga::Heap &heap,
+on_heap_removed (gmref_ptr<Ekiga::Cluster> /*cluster*/,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data)
{
RosterViewGtk *self = ROSTER_VIEW_GTK (data);
@@ -926,25 +928,25 @@
static bool
-visit_presentities (Ekiga::Presentity &presentity,
- Ekiga::Cluster *cluster,
- Ekiga::Heap *heap,
+visit_presentities (gmref_ptr<Ekiga::Presentity> presentity,
+ gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
gpointer data)
{
- on_presentity_added (*cluster, *heap, presentity, data);
+ on_presentity_added (cluster, heap, presentity, data);
return true;
}
static void
-on_presentity_added (Ekiga::Cluster &/*cluster*/,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+on_presentity_added (gmref_ptr<Ekiga::Cluster> /*cluster*/,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data)
{
RosterViewGtk *self = ROSTER_VIEW_GTK (data);
GtkTreeIter heap_iter;
- std::set<std::string> groups = presentity.get_groups ();
+ std::set<std::string> groups = presentity->get_groups ();
GtkTreeIter group_iter;
GtkTreeIter iter;
bool active = false;
@@ -952,8 +954,8 @@
roster_view_gtk_find_iter_for_heap (self, heap, &heap_iter);
- active = presentity.get_presence () != "offline";
- away = presentity.get_presence () == "away";
+ active = presentity->get_presence () != "offline";
+ away = presentity->get_presence () == "away";
for (std::set<std::string>::const_iterator group = groups.begin ();
group != groups.end ();
@@ -966,11 +968,11 @@
gtk_tree_store_set (self->priv->store, &iter,
COLUMN_TYPE, TYPE_PRESENTITY,
COLUMN_OFFLINE, active,
- COLUMN_HEAP, &heap,
- COLUMN_PRESENTITY, &presentity,
- COLUMN_NAME, presentity.get_name ().c_str (),
- COLUMN_STATUS, presentity.get_status ().c_str (),
- COLUMN_PRESENCE, presentity.get_presence ().c_str (),
+ COLUMN_HEAP, &*heap,
+ COLUMN_PRESENTITY, &*presentity,
+ COLUMN_NAME, presentity->get_name ().c_str (),
+ COLUMN_STATUS, presentity->get_status ().c_str (),
+ COLUMN_PRESENCE, presentity->get_presence ().c_str (),
COLUMN_ACTIVE, (!active || away) ? "gray" : "black",
-1);
}
@@ -983,11 +985,11 @@
gtk_tree_store_set (self->priv->store, &iter,
COLUMN_TYPE, TYPE_PRESENTITY,
COLUMN_OFFLINE, active,
- COLUMN_HEAP, &heap,
- COLUMN_PRESENTITY, &presentity,
- COLUMN_NAME, presentity.get_name ().c_str (),
- COLUMN_STATUS, presentity.get_status ().c_str (),
- COLUMN_PRESENCE, presentity.get_presence ().c_str (),
+ COLUMN_HEAP, &*heap,
+ COLUMN_PRESENTITY, &*presentity,
+ COLUMN_NAME, presentity->get_name ().c_str (),
+ COLUMN_STATUS, presentity->get_status ().c_str (),
+ COLUMN_PRESENCE, presentity->get_presence ().c_str (),
COLUMN_ACTIVE, active ? "black" : "gray",
-1);
}
@@ -997,9 +999,9 @@
static void
-on_presentity_updated (Ekiga::Cluster &cluster,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+on_presentity_updated (gmref_ptr<Ekiga::Cluster> cluster,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data)
{
RosterViewGtk *self = (RosterViewGtk *)data;
@@ -1008,7 +1010,7 @@
GtkTreeIter group_iter;
GtkTreeIter iter;
gchar *group_name = NULL;
- std::set<std::string> groups = presentity.get_groups ();
+ std::set<std::string> groups = presentity->get_groups ();
model = GTK_TREE_MODEL (self->priv->store);
@@ -1045,9 +1047,9 @@
static void
-on_presentity_removed (Ekiga::Cluster &/*cluster*/,
- Ekiga::Heap &heap,
- Ekiga::Presentity &presentity,
+on_presentity_removed (gmref_ptr<Ekiga::Cluster> /*cluster*/,
+ gmref_ptr<Ekiga::Heap> heap,
+ gmref_ptr<Ekiga::Presentity> presentity,
gpointer data)
{
RosterViewGtk *self = ROSTER_VIEW_GTK (data);
@@ -1089,7 +1091,7 @@
*/
static void
roster_view_gtk_find_iter_for_heap (RosterViewGtk *view,
- Ekiga::Heap &heap,
+ gmref_ptr<Ekiga::Heap> heap,
GtkTreeIter *iter)
{
GtkTreeModel *model = NULL;
@@ -1103,8 +1105,9 @@
do {
gtk_tree_model_get (model, iter, COLUMN_HEAP, &iter_heap, -1);
- if (iter_heap == &heap)
+ if (iter_heap == &*heap)
found = TRUE;
+ gmref_dec (iter_heap);
} while (!found && gtk_tree_model_iter_next (model, iter));
}
@@ -1115,7 +1118,7 @@
static void
roster_view_gtk_find_iter_for_group (RosterViewGtk *view,
- Ekiga::Heap& heap,
+ gmref_ptr<Ekiga::Heap> heap,
GtkTreeIter *heap_iter,
const std::string name,
GtkTreeIter *iter)
@@ -1143,7 +1146,7 @@
gtk_tree_store_append (view->priv->store, iter, heap_iter);
gtk_tree_store_set (view->priv->store, iter,
COLUMN_TYPE, TYPE_GROUP,
- COLUMN_HEAP, &heap,
+ COLUMN_HEAP, &*heap,
COLUMN_NAME, name.c_str (),
-1);
}
@@ -1153,7 +1156,7 @@
static void
roster_view_gtk_find_iter_for_presentity (RosterViewGtk *view,
GtkTreeIter *group_iter,
- Ekiga::Presentity &presentity,
+ gmref_ptr<Ekiga::Presentity> presentity,
GtkTreeIter *iter)
{
GtkTreeModel *model = NULL;
@@ -1167,8 +1170,9 @@
do {
gtk_tree_model_get (model, iter, COLUMN_PRESENTITY, &iter_presentity, -1);
- if (iter_presentity == &presentity)
+ if (iter_presentity == &*presentity)
found = TRUE;
+ gmref_dec (iter_presentity);
} while (!found && gtk_tree_model_iter_next (model, iter));
}
@@ -1407,15 +1411,15 @@
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
self->priv->store = gtk_tree_store_new (COLUMN_NUMBER,
- G_TYPE_INT, // type
- G_TYPE_POINTER, // heap
- G_TYPE_POINTER, // presentity
- G_TYPE_STRING, // name
- G_TYPE_STRING, // status
- G_TYPE_STRING, // presence
- G_TYPE_STRING, // color if active
- G_TYPE_STRING, // group size
- G_TYPE_BOOLEAN); // offline
+ G_TYPE_INT, // type
+ GM_TYPE_REFCOUNTED, // heap
+ GM_TYPE_REFCOUNTED, // presentity
+ G_TYPE_STRING, // name
+ G_TYPE_STRING, // status
+ G_TYPE_STRING, // presence
+ G_TYPE_STRING, // color if active
+ G_TYPE_STRING, // group size
+ G_TYPE_BOOLEAN); // offline
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->priv->store),
COLUMN_NAME, GTK_SORT_ASCENDING);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]