Mercurial > pidgin.yaz
changeset 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 | 7e309149360f |
children | da183b86a3ef |
files | finch/libgnt/gntwm.c finch/libgnt/gntws.c finch/libgnt/gntws.h |
diffstat | 3 files changed, 22 insertions(+), 2 deletions(-) [+] |
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) {
--- 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;
--- 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 *);