Mercurial > pidgin.yaz
diff finch/libgnt/gntwm.c @ 19109:1cb69ea47a6e
propagate from branch 'im.pidgin.pidgin' (head d2f50519c5ed668dd980277afdc25d71ccb8a852)
to branch 'im.pidgin.soc.2007.finchfeat' (head 6429a075d71b5b1cc70abf9b5d55875f793168c8)
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Thu, 21 Jun 2007 20:37:57 +0000 |
parents | a1ac8b05ecdb af7b944374ba |
children | 60c6090c0e29 |
line wrap: on
line diff
--- a/finch/libgnt/gntwm.c Tue Jun 19 19:40:06 2007 +0000 +++ b/finch/libgnt/gntwm.c Thu Jun 21 20:37:57 2007 +0000 @@ -338,8 +338,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; @@ -1005,12 +1004,11 @@ GntWM *wm = GNT_WM(bindable); endwin(); - refresh(); - curs_set(0); /* endwin resets the cursor to normal */ g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); update_screen(wm); gnt_ws_draw_taskbar(wm->cws, TRUE); + curs_set(0); /* endwin resets the cursor to normal */ return FALSE; } @@ -1104,6 +1102,16 @@ } 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 gboolean ignore_keys_start(GntBindable *bindable, GList *n) { GntWM *wm = GNT_WM(bindable); @@ -1302,6 +1310,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, @@ -1366,6 +1376,7 @@ return type; } + void gnt_wm_add_workspace(GntWM *wm, GntWS *ws) { @@ -1503,12 +1514,39 @@ return FALSE; } +#if !GLIB_CHECK_VERSION(2,4,0) +typedef struct +{ + GntWM *wm; + GntWS *ret; + gchar *title; +} title_search; + +static void match_title_search(gpointer key, gpointer value, gpointer search) +{ + title_search *s = search; + if (s->ret) + return; + if (match_title(key, NULL, s->title)) + s->ret = g_hash_table_lookup(s->wm->title_places, key); +} +#endif + static GntWS * new_widget_find_workspace(GntWM *wm, GntWidget *widget, gchar *wid_title) { GntWS *ret; const gchar *name; +#if GLIB_CHECK_VERSION(2,4,0) ret = g_hash_table_find(wm->title_places, match_title, wid_title); +#else + title_search *s = NULL; + s = g_new0(title_search, 1); + s->wm = wm; + s->title = wid_title; + g_hash_table_foreach(wm->title_places, match_title_search, s); + ret = s->ret; +#endif if (ret) return ret; name = gnt_widget_get_name(widget); @@ -1600,6 +1638,7 @@ gnt_wm_raise_window(wm, node->me); } else { bottom_panel(node->panel); /* New windows should not grab focus */ + gnt_widget_set_focus(node->me, FALSE); gnt_widget_set_urgent(node->me); if (wm->cws != ws) gnt_ws_widget_hide(widget, wm->nodes);