[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31878 - in gnunet-gtk: contrib src/peerinfo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31878 - in gnunet-gtk: contrib src/peerinfo |
Date: |
Fri, 10 Jan 2014 13:25:23 +0100 |
Author: grothoff
Date: 2014-01-10 13:25:23 +0100 (Fri, 10 Jan 2014)
New Revision: 31878
Modified:
gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
Log:
adding tooltips to highlight expiration times to gnunet-peerinfo-gtk
Modified: gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade 2014-01-10
11:44:36 UTC (rev 31877)
+++ gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade 2014-01-10
12:25:23 UTC (rev 31878)
@@ -204,7 +204,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_connectivity_treeviewcolumn">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn">
<property name="spacing">2</property>
<property name="sizing">autosize</property>
<property name="widget">connected_image_core</property>
@@ -220,7 +220,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_plugin_treeviewcolumn">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn">
<property name="widget">connected_image_plugin</property>
<property name="reorderable">True</property>
<property name="sort_indicator">True</property>
@@ -234,7 +234,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_core_timeout_treeviewcolumn">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn">
<property name="widget">connected_image_ats</property>
<child>
<object class="GtkCellRendererPixbuf"
id="GNUNET_PEERINFO_GTK_main_window_ats_led_cellrendererpixbuf"/>
@@ -246,7 +246,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_transport_led_treeviewcolumn">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn">
<property
name="widget">connected_image_neighbours</property>
<property name="reorderable">True</property>
<property name="sort_indicator">True</property>
@@ -260,7 +260,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_validation_led_treeviewcolumn">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn">
<property name="widget">validated_image</property>
<property name="reorderable">True</property>
<property name="sort_indicator">True</property>
@@ -305,7 +305,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_bandwidth_column">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_bandwidth_in_column">
<property name="title">In</property>
<property name="clickable">True</property>
<property name="reorderable">True</property>
@@ -341,7 +341,7 @@
<property name="sort_indicator">True</property>
<property name="sort_column_id">11</property>
<child>
- <object class="GtkCellRendererText"
id="cellrenderertext1"/>
+ <object class="GtkCellRendererText"
id="GNUNET_PEERINFO_GTK_main_window_plugin_name_cellrenderertext"/>
<attributes>
<attribute name="text">11</attribute>
</attributes>
@@ -349,14 +349,14 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <object class="GtkTreeViewColumn"
id="GNUNET_PEERINFO_GTK_main_window_neighbour_state_treeviewcolumn">
<property name="sizing">autosize</property>
<property name="title" translatable="yes">State</property>
<property name="reorderable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">16</property>
<child>
- <object class="GtkCellRendererText"
id="cellrenderertext2"/>
+ <object class="GtkCellRendererText"
id="GNUNET_PEERINFO_GTK_main_window_neighbour_state_cellrenderertext"/>
<attributes>
<attribute name="text">16</attribute>
</attributes>
Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2014-01-10 11:44:36 UTC
(rev 31877)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2014-01-10 12:25:23 UTC
(rev 31878)
@@ -356,7 +356,37 @@
*/
static struct GNUNET_CONTAINER_MultiPeerMap *friends;
+/**
+ * Tree view column for CORE connecitivity.
+ */
+static GtkTreeViewColumn *tvc_core_connectivity;
+/**
+ * Tree view column for TRANSPORT connecitivity.
+ */
+static GtkTreeViewColumn *tvc_transport_connectivity;
+
+/**
+ * Tree view column for ATS connecitivity.
+ */
+static GtkTreeViewColumn *tvc_ats_connectivity;
+
+/**
+ * Tree view column for plugin connecitivity.
+ */
+static GtkTreeViewColumn *tvc_plugin_connectivity;
+
+/**
+ * Tree view column for validation status
+ */
+static GtkTreeViewColumn *tvc_validation_status;
+
+/**
+ * Tree view column for neighbour_state
+ */
+static GtkTreeViewColumn *tvc_neighbour_state;
+
+
#if HAVE_LIBUNIQUE
static UniqueApp *unique_app;
#endif
@@ -1070,6 +1100,74 @@
/**
+ * Return the tooltip for the given coordinate.
+ *
+ * @param widget our tree view
+ * @param x x-coordinate
+ * @param y y-coordinate
+ * @param keyboard_tip triggered by keyboard?
+ * @param tooltip tooltip object to fill
+ * @param data NULL
+ * @return TRUE if a tooltip was provided
+ */
+static gboolean
+query_tooltip_cb (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_tip,
+ GtkTooltip *tooltip,
+ gpointer data)
+{
+ GtkTreeView *tv = GTK_TREE_VIEW (widget);
+ GtkTreeModel *model = GTK_TREE_MODEL (ts);
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeViewColumn *column;
+ int model_column = -1;
+ gchar *tmp;
+
+ if (! gtk_tree_view_get_tooltip_context (tv, &x, &y,
+ keyboard_tip,
+ &model, &path, &iter))
+ return FALSE;
+ if (! gtk_tree_view_get_path_at_pos (tv, x, y, NULL, &column, NULL, NULL))
+ return FALSE;
+
+ if (tvc_core_connectivity == column)
+ model_column = -1;
+ else if (tvc_plugin_connectivity == column)
+ model_column = PEERINFO_MC_PLUGIN_CONNECTIVITY_TIMEOUT_AS_STRING;
+ else if (tvc_ats_connectivity == column)
+ model_column = PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION;
+ else if (tvc_transport_connectivity == column)
+ model_column = PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING;
+ else if (tvc_validation_status == column)
+ model_column = PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING;
+ else if (tvc_neighbour_state == column)
+ model_column = PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING;
+ if (-1 == model_column)
+ return FALSE;
+
+ gtk_tree_model_get (model,
+ &iter,
+ model_column, &tmp,
+ -1);
+ if (NULL == tmp)
+ return FALSE;
+ gtk_tooltip_set_text (tooltip,
+ tmp);
+ gtk_tree_view_set_tooltip_cell (tv,
+ tooltip,
+ path,
+ column,
+ NULL);
+ g_free (tmp);
+ gtk_tree_path_free (path);
+ return TRUE;
+}
+
+
+/**
* Actual main function run right after GNUnet's scheduler
* is initialized. Initializes up GTK and Glade.
*
@@ -1081,6 +1179,7 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GtkWidget *main_window;
+ GtkTreeView *tv;
ml = cts;
if (GNUNET_OK !=
@@ -1123,6 +1222,12 @@
NULL);
ats = GNUNET_ATS_performance_init (get_configuration (),
&status_cb, NULL);
+ tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn"));
+ tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn"));
+ tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn"));
+ tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn"));
+ tvc_validation_status = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn"));
+ tvc_neighbour_state = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_neighbour_state_treeviewcolumn"));
/* setup main window */
main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
main_window = GNUNET_GTK_plug_me ("GNUNET_PEERINFO_GTK_PLUG",
@@ -1136,6 +1241,12 @@
"gnunet-gtk" /* FIXME: different icon? */ ,
"gnunet-peerinfo-gtk");
+ tv = GTK_TREE_VIEW (get_object ("GNUNET_PEERINFO_GTK_main_window_treeview"));
+ g_object_set (tv, "has-tooltip", TRUE, NULL);
+ g_signal_connect (tv, "query-tooltip",
+ G_CALLBACK (query_tooltip_cb),
+ NULL);
+
#if HAVE_LIBUNIQUE
unique_app_watch_window (unique_app, GTK_WINDOW (main_window));
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31878 - in gnunet-gtk: contrib src/peerinfo,
gnunet <=