[Commits] callbacks.c 1.15 1.16 callbacks.h 1.2 1.3 mainwindow.c 1.7 1.8

miras at claws-mail.org miras at claws-mail.org
Sun Dec 18 02:00:44 CET 2011


Update of /home/claws-mail/contacts/src
In directory claws-mail:/tmp/cvs-serv32325/src

Modified Files:
	callbacks.c callbacks.h mainwindow.c 
Log Message:
2011-12-18 [mir]	0.6.0cvs54

	* src/callbacks.c
	* src/callbacks.h
	* src/mainwindow.c
	    Implemented keyboard shortcuts on the mainwindon
	    for deleting and displaying/editing contacts.
	    (s: show/edit contact. Delete: delete contact)
	    Fix a minor memory leak. 

Index: callbacks.c
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- callbacks.c	14 Dec 2011 08:27:03 -0000	1.15
+++ callbacks.c	18 Dec 2011 01:00:42 -0000	1.16
@@ -2003,6 +2003,7 @@
 		g_free(cn);
 		g_free(first);
 		g_free(last);
+		g_free(con_id);
 	}
 }
 
@@ -2361,3 +2362,38 @@
 		g_key_file_free(config->key_file);
 	}
 }
+
+gboolean mainwindow_key_press_event_cb(GtkWidget *widget,
+									   GdkEventKey *event,
+									   gpointer   user_data) {
+	MainWindow* win = (MainWindow *) user_data;
+	GtkTreeView* view;
+    Contact* contact;
+	
+	if (!event) return FALSE;
+	
+	switch (event->keyval) {
+		case GDK_KEY_s:
+			view = GTK_TREE_VIEW(win->contact_list);
+
+			contact = get_selected_contact(view);
+			if (contact) {
+				win->selected_contact = contact;
+				contact_edit_cb(widget, win);
+			}
+			return TRUE;
+		case GDK_KEY_Delete:
+			view = GTK_TREE_VIEW(win->contact_list);
+
+			contact = get_selected_contact(view);
+			if (contact) {
+				win->selected_contact = contact;
+				contact_delete_cb(widget, win);
+			}
+			return TRUE;
+		default:
+			break;
+	}
+	
+	return FALSE;
+}
\ No newline at end of file

Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/contacts/src/mainwindow.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mainwindow.c	9 Dec 2011 23:06:00 -0000	1.7
+++ mainwindow.c	18 Dec 2011 01:00:42 -0000	1.8
@@ -603,6 +603,8 @@
             GTK_WINDOW(window), mainwindow->search_btn);
     g_signal_connect(
         window, "delete_event", G_CALLBACK(delete_event), mainwindow);
+    g_signal_connect(window, "key-press-event",
+        G_CALLBACK(mainwindow_key_press_event_cb), mainwindow);
 }
 
 static GList* load_pixmaps() {

Index: callbacks.h
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- callbacks.h	20 Nov 2011 21:24:20 -0000	1.2
+++ callbacks.h	18 Dec 2011 01:00:42 -0000	1.3
@@ -116,6 +116,9 @@
 						 GtkTreeIter* iter,
 						 gpointer data);
 void config_main_free(ConfigFile* config);
+gboolean mainwindow_key_press_event_cb(GtkWidget *widget,
+									   GdkEventKey *event,
+									   gpointer   user_data);
 
 G_END_DECLS
 



More information about the Commits mailing list