Re: small patch to add a close button to the find bar for logview
- From: "David Hugh-Jones" <davidhughjones gmail com>
- To: "Reinout van Schouwen" <reinouts gnome org>
- Cc: gnome-utils-list gnome org
- Subject: Re: small patch to add a close button to the find bar for logview
- Date: Mon, 18 Aug 2008 00:00:51 +0200
E.g. like this
David Hugh-Jones
PhD Candidate
Essex University Department of Government
http://davidhughjones.googlepages.com
2008/8/17 David Hugh-Jones <davidhughjones gmail com>:
> Fair enough - though it's not obvious at the moment how to get rid of
> the filter.
>
> In any case, the one I really want to go for is the problem of long
> lines in the log file. I thought implementing word wrap would be ideal
> but maybe that's hard in the context of a GtkTreeView? So an
> alternative might be tooltips of the whole line... what do you think?
>
> David Hugh-Jones
> PhD Candidate
> Essex University Department of Government
> http://davidhughjones.googlepages.com
>
>
>
> 2008/8/17 Reinout van Schouwen <reinouts gnome org>:
>> Hi David,
>>
>> Op zondag 17-08-2008 om 20:09 uur [tijdzone +0200], schreef David
>> Hugh-Jones:
>>> This is just me dipping my toe into Gnome coding - comments welcome.
>>
>> Thanks for your contribution, but:
>>
>> we try to make all Find bars within Gnome work alike. Please look at
>> Epiphany, Evince and Yelp for examples. Instead of a close button on the
>> find bar we prefer to close it when focus is lost.
>>
>> regards,
>>
>> --
>> Reinout van Schouwen
>>
>>
>> _______________________________________________
>> gnome-utils-list mailing list
>> gnome-utils-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gnome-utils-list
>>
>
Index: logview/logview.c
===================================================================
--- logview/logview.c (revision 8008)
+++ logview/logview.c (working copy)
@@ -786,6 +786,32 @@ window_size_changed_cb (GtkWidget *widge
return FALSE;
}
+static gboolean
+query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode,
+GtkTooltip *tooltip, gpointer data)
+{
+ GtkTreeIter iter;
+ GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+ GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+ GtkTreePath *path = NULL;
+ gchar *wholeline;
+ gchar *pathstring;
+
+ if (!gtk_tree_view_get_tooltip_context(tree_view, &x, &y, keyboard_mode,
+ &model, &path, &iter)) return FALSE;
+ // now we have something in path
+ gtk_tree_model_get (model, &iter, 0, &wholeline, -1);
+ // now we have something in tmp
+ gtk_tooltip_set_text(tooltip, wholeline);
+ pathstring = gtk_tree_path_to_string (path);
+ gtk_tree_view_set_tooltip_row (tree_view, tooltip, path);
+ gtk_tree_path_free(path);
+ g_free(pathstring);
+ g_free(wholeline);
+
+ return TRUE;
+}
+
static void
logview_window_finalize (GObject *object)
{
@@ -880,6 +906,7 @@ logview_init (LogviewWindow *logview)
logview->view = gtk_tree_view_new ();
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (logview->view), FALSE);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (logview->view), FALSE);
+ g_object_set(G_OBJECT(logview->view), "has-tooltip", TRUE, NULL);
/* Use the desktop monospace font */
monospace_font_name = prefs_get_monospace ();
@@ -932,6 +959,8 @@ logview_init (LogviewWindow *logview)
G_CALLBACK (row_toggled_cb), logview);
g_signal_connect (G_OBJECT (logview->view), "row-collapsed",
G_CALLBACK (row_toggled_cb), logview);
+ g_signal_connect (G_OBJECT(logview->view), "query-tooltip",
+ G_CALLBACK(query_tooltip_cb), NULL);
g_signal_connect (G_OBJECT (logview), "configure_event",
G_CALLBACK (window_size_changed_cb), logview);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]