# HG changeset patch # User Sadrul Habib Chowdhury # Date 1181489991 0 # Node ID 34e011c8ed2bb2c1b8444112cb2db16305e67b60 # Parent 7e309149360f9a4249cba05847d707fa9d60aeaf F9 to create a new workspace. diff -r 7e309149360f -r 34e011c8ed2b finch/libgnt/gntwm.c --- 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) { diff -r 7e309149360f -r 34e011c8ed2b finch/libgnt/gntws.c --- a/finch/libgnt/gntws.c Sun Jun 10 15:16:53 2007 +0000 +++ b/finch/libgnt/gntws.c Sun Jun 10 15:39:51 2007 +0000 @@ -154,6 +154,13 @@ return type; } +GntWS *gnt_ws_new(const char *name) +{ + GntWS *ws = GNT_WS(g_object_new(GNT_TYPE_WS, NULL)); + ws->name = g_strdup(name ? name : "(noname)"); + return ws; +} + const char * gnt_ws_get_name(GntWS *ws) { return ws->name; diff -r 7e309149360f -r 34e011c8ed2b finch/libgnt/gntws.h --- a/finch/libgnt/gntws.h Sun Jun 10 15:16:53 2007 +0000 +++ b/finch/libgnt/gntws.h Sun Jun 10 15:39:51 2007 +0000 @@ -45,6 +45,7 @@ GType gnt_ws_get_gtype(void); +GntWS *gnt_ws_new(const char *name); void gnt_ws_set_name(GntWS *, const gchar *); void gnt_ws_add_widget(GntWS *, GntWidget *); void gnt_ws_remove_widget(GntWS *, GntWidget *);