SF.net SVN: geany-plugins:[1035] trunk/geany-plugins/addons

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Oct 26 22:42:09 UTC 2009


Revision: 1035
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1035&view=rev
Author:   eht16
Date:     2009-10-26 22:42:08 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Add an 'activate' keybinding.

Modified Paths:
--------------
    trunk/geany-plugins/addons/ChangeLog
    trunk/geany-plugins/addons/src/addons.c
    trunk/geany-plugins/addons/src/ao_bookmarklist.c
    trunk/geany-plugins/addons/src/ao_bookmarklist.h

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2009-10-26 22:24:29 UTC (rev 1034)
+++ trunk/geany-plugins/addons/ChangeLog	2009-10-26 22:42:08 UTC (rev 1035)
@@ -1,3 +1,9 @@
+2009-10-26  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/addons.c, src/bookmarklist.c, src/bookmarklist.h:
+   Add an 'activate' keybinding.
+
+
 2009-10-25  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/Makefile.am, src/addons.c, src/bookmarklist.c,

Modified: trunk/geany-plugins/addons/src/addons.c
===================================================================
--- trunk/geany-plugins/addons/src/addons.c	2009-10-26 22:24:29 UTC (rev 1034)
+++ trunk/geany-plugins/addons/src/addons.c	2009-10-26 22:42:08 UTC (rev 1035)
@@ -42,6 +42,16 @@
 	"Enrico Tröger, Bert Vermeulen")
 
 
+/* Keybinding(s) */
+enum
+{
+	KB_FOCUS_BOOKMARK_LIST,
+	KB_COUNT
+};
+
+PLUGIN_KEY_GROUP(addons, KB_COUNT)
+
+
 typedef struct
 {
 	/* general settings */
@@ -82,6 +92,12 @@
 };
 
 
+static void kb_bmlist_activate(guint key_id)
+{
+	ao_bookmark_list_activate(ao_info->bookmarklist);
+}
+
+
 gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor,
 							 SCNotification *nt, gpointer data)
 {
@@ -154,6 +170,10 @@
 	ao_info->bookmarklist = ao_bookmark_list_new(ao_info->enable_bookmarklist);
 
 	tasks_set_enable(ao_info->enable_tasks);
+
+	/* setup keybindings */
+	keybindings_set_item(plugin_key_group, KB_FOCUS_BOOKMARK_LIST, kb_bmlist_activate,
+		0, 0, "focus_bookmark_list", _("Focus Bookmark List"), NULL);
 }
 
 

Modified: trunk/geany-plugins/addons/src/ao_bookmarklist.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_bookmarklist.c	2009-10-26 22:24:29 UTC (rev 1034)
+++ trunk/geany-plugins/addons/src/ao_bookmarklist.c	2009-10-26 22:42:08 UTC (rev 1035)
@@ -34,7 +34,6 @@
 /*
  * TODO
  * - context menu
- * - activate keybinding
  */
 
 typedef struct _AoBookmarkListPrivate			AoBookmarkListPrivate;
@@ -56,10 +55,10 @@
 {
 	gboolean enable_bookmarklist;
 
-	GtkWidget *box;
+	gint page_number;
 
-	gint page_number;
 	GtkListStore *store;
+	GtkWidget *tree;
 
 	gint		 search_line;
 	GtkTreeIter	*search_iter;
@@ -308,9 +307,23 @@
 		gtk_label_new(_("Bookmarks")));
 
 	priv->store = store;
+	priv->tree = GTK_WIDGET(tree);
 }
 
 
+void ao_bookmark_list_activate(AoBookmarkList *bm)
+{
+	AoBookmarkListPrivate *priv = AO_BOOKMARK_LIST_GET_PRIVATE(bm);
+
+	if (priv->enable_bookmarklist)
+	{
+		gtk_notebook_set_current_page(
+			GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), priv->page_number);
+		gtk_widget_grab_focus(priv->tree);
+	}
+}
+
+
 void ao_bookmark_list_update(AoBookmarkList *bm, GeanyDocument *doc)
 {
 	gint line_nr = 0;

Modified: trunk/geany-plugins/addons/src/ao_bookmarklist.h
===================================================================
--- trunk/geany-plugins/addons/src/ao_bookmarklist.h	2009-10-26 22:24:29 UTC (rev 1034)
+++ trunk/geany-plugins/addons/src/ao_bookmarklist.h	2009-10-26 22:42:08 UTC (rev 1035)
@@ -44,6 +44,7 @@
 void			ao_bookmark_list_update			(AoBookmarkList *bm, GeanyDocument *doc);
 void 			ao_bookmark_list_update_marker	(AoBookmarkList *bm, GeanyEditor *editor,
 												 SCNotification *nt);
+void			ao_bookmark_list_activate		(AoBookmarkList *bm);
 
 G_END_DECLS
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list