diff finch/libgnt/gntwm.c @ 18075:34e011c8ed2b

F9 to create a new workspace.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 10 Jun 2007 15:39:51 +0000
parents 2b757aadddc9
children 2141130ac557
line wrap: on
line diff
--- a/finch/libgnt/gntwm.c	Sun Jun 10 15:16:53 2007 +0000
+++ b/finch/libgnt/gntwm.c	Sun Jun 10 15:39:51 2007 +0000
@@ -335,8 +335,7 @@
 	wm->title_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 	gnt_style_read_workspaces(wm);
 	if (wm->workspaces == NULL) {
-		wm->cws = g_object_new(GNT_TYPE_WS, NULL);
-		gnt_ws_set_name(wm->cws, "default");
+		wm->cws = gnt_ws_new("default");
 		gnt_wm_add_workspace(wm, wm->cws);
 	} else {
 		wm->cws = wm->workspaces->data;
@@ -1128,6 +1127,16 @@
 	return TRUE;
 }
 
+static gboolean
+workspace_new(GntBindable *bindable, GList *null)
+{
+	GntWM *wm = GNT_WM(bindable);
+	GntWS *ws = gnt_ws_new(NULL);
+	gnt_wm_add_workspace(wm, ws);
+	gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
+	return TRUE;
+}
+
 static void
 gnt_wm_class_init(GntWMClass *klass)
 {
@@ -1262,6 +1271,8 @@
 				"\033" GNT_KEY_CTRL_K, NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget,
 				"\033" "/", NULL);
+	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-new", workspace_new,
+				GNT_KEY_F9, NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-next", workspace_next,
 				"\033" ">", NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-prev", workspace_prev,
@@ -1316,6 +1327,7 @@
 
 	return type;
 }
+
 void
 gnt_wm_add_workspace(GntWM *wm, GntWS *ws)
 {