changeset 18495:64391b1e860e

Make the "Browse Logs Folder" button open the folder containing the log currently being displayed. Fixes #2115
author Richard Laager <rlaager@wiktel.com>
date Thu, 12 Jul 2007 04:34:02 +0000
parents dc98087bd97c
children f4d05584369e d679ee8062bf
files pidgin/gtklog.c
diffstat 1 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtklog.c	Thu Jul 12 03:41:37 2007 +0000
+++ b/pidgin/gtklog.c	Thu Jul 12 04:34:02 2007 +0000
@@ -172,7 +172,32 @@
 
 #ifdef _WIN32
 	if (resp == GTK_RESPONSE_HELP) {
-		char *logdir = g_build_filename(purple_user_dir(), "logs", NULL);
+		GtkTreeSelection *sel;
+		GtkTreeIter iter;
+		GtkTreeModel *model;
+		PurpleLog *log = NULL;
+		char *logdir;
+
+		if (ht != NULL)
+			lv = g_hash_table_lookup(log_viewers, ht);
+		model = GTK_TREE_MODEL(lv->treestore);
+
+		sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview));
+		if (gtk_tree_selection_get_selected(sel, &model, &iter)) {
+			GValue val;
+
+			val.g_type = 0;
+			gtk_tree_model_get_value (model, &iter, 1, &val);
+			log = g_value_get_pointer(&val);
+			g_value_unset(&val);
+		}
+
+
+		if (log == NULL)
+			logdir = g_build_filename(purple_user_dir(), "logs", NULL);
+		else
+			logdir = purple_log_get_log_dir(log->type, log->name, log->account);
+
 		winpidgin_shell_execute(logdir, "explore", NULL);
 		g_free(logdir);
 		return;
@@ -368,7 +393,7 @@
 	gpointer *data;
 
 	iter = g_new(GtkTreeIter, 1);
-	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv));
+	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(lv->treeview));
 	if (!gtk_tree_selection_get_selected(sel, NULL, iter))
 	{
 		return FALSE;