summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-22 19:52:07 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-22 20:11:13 -0800
commit713c845e5a04a5ea5a41d1d8de3dc5c16b0e8df5 (patch)
tree72dc14770d34098a444d1ac3940ec8a2c5cb5d25 /gtk-gui.c
parentc02f1b88ab5a0a9d6fadf56468910d76ce0b1c5d (diff)
downloadsubsurface-713c845e5a04a5ea5a41d1d8de3dc5c16b0e8df5.tar.gz
Add GPS icon to the location column for dive sites where we have GPS data
This replaces the really lame "italics text" from commit abe810ca1a29 ("Mark locations that have GPS location data attached") with a marginally less lame GPS icon.There's a reason why I am not making a living as graphics artist. But I think this is a huge step forward from what we had before... The satellite.svg file is very loosely based on a different icon that I found as public domain here http://www.clker.com/clipart-30400.html. From that I created the PNG and then that was converted into the GdkPixdata via gdk-pixbuf-csource; a rule for that was added to the Makefile but commented out as I don't know if this tool will always be available in the path. Having this icon included in the sources avoids locating yet another icon file. Better icons are certainly welcome! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 7a8f10c68..01615976c 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -343,6 +343,15 @@ void quit(GtkWidget *w, gpointer data)
}
}
+GtkTreeViewColumn *tree_view_column_add_pixbuf(GtkWidget *tree_view, data_func_t data_func, GtkTreeViewColumn *col)
+{
+ GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_column_pack_start(col, renderer, FALSE);
+ gtk_tree_view_column_set_cell_data_func(col, renderer, data_func, NULL, NULL);
+ g_signal_connect(tree_view, "button-press-event", G_CALLBACK(icon_click_cb), col);
+ return col;
+}
+
GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title,
data_func_t data_func, unsigned int flags)
{
@@ -370,7 +379,10 @@ GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char
if (!(flags & UNSORTABLE))
gtk_tree_view_column_set_sort_column_id(col, index);
gtk_tree_view_column_set_resizable(col, TRUE);
- gtk_tree_view_column_pack_start(col, renderer, TRUE);
+ /* all but one column have only one renderer - so packing from the end
+ * makes no difference; for the location column we want to be able to
+ * prepend the icon in front of the text - so this works perfectly */
+ gtk_tree_view_column_pack_end(col, renderer, TRUE);
if (data_func)
gtk_tree_view_column_set_cell_data_func(col, renderer, data_func, (void *)(long)index, NULL);
else