static void workspace_destroyed (WnckScreen *screen, WnckWorkspace *space, PagerData *pager) { g_return_if_fail (WNCK_IS_SCREEN (screen)); update_workspaces_model (pager); }
static void workspace_created(WnckScreen* screen, WnckWorkspace* space, PagerData* pager) { g_return_if_fail(WNCK_IS_SCREEN(screen)); update_workspaces_model(pager); wncklet_connect_while_alive(space, "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog); }
static void setup_dialog (GtkBuilder *builder, PagerData *pager) { gboolean value; GtkTreeViewColumn *column; GtkCellRenderer *cell; int nr_ws, i; pager->workspaces_frame = WID ("workspaces_frame"); pager->workspace_names_label = WID ("workspace_names_label"); pager->workspace_names_scroll = WID ("workspace_names_scroll"); pager->display_workspaces_toggle = WID ("workspace_name_toggle"); setup_sensitivity (pager, builder, "workspace_name_toggle", NULL, NULL, "display-workspace-names" /* key */); pager->all_workspaces_radio = WID ("all_workspaces_radio"); pager->current_only_radio = WID ("current_only_radio"); setup_sensitivity (pager, builder, "all_workspaces_radio", "current_only_radio", "label_row_col", "display-all-workspaces" /* key */); pager->num_rows_spin = WID ("num_rows_spin"); pager->label_row_col = WID("label_row_col"); setup_sensitivity (pager, builder, "num_rows_spin", NULL, NULL, "num-rows" /* key */); pager->num_workspaces_spin = WID ("num_workspaces_spin"); pager->workspaces_tree = WID ("workspaces_tree_view"); /* Display workspace names: */ g_signal_connect (G_OBJECT (pager->display_workspaces_toggle), "toggled", (GCallback) display_workspace_names_toggled, pager); if (pager->display_mode == WNCK_PAGER_DISPLAY_NAME) { value = TRUE; } else { value = FALSE; } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pager->display_workspaces_toggle), value); /* Display all workspaces: */ g_signal_connect (G_OBJECT (pager->all_workspaces_radio), "toggled", (GCallback) all_workspaces_toggled, pager); if (pager->display_all) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pager->all_workspaces_radio), TRUE); if ( ! g_object_get_data (G_OBJECT (pager->num_rows_spin), NEVER_SENSITIVE)) gtk_widget_set_sensitive (pager->num_rows_spin, TRUE); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pager->current_only_radio), TRUE); gtk_widget_set_sensitive (pager->num_rows_spin, FALSE); } /* Num rows: */ g_signal_connect (G_OBJECT (pager->num_rows_spin), "value_changed", (GCallback) num_rows_value_changed, pager); gtk_spin_button_set_value (GTK_SPIN_BUTTON (pager->num_rows_spin), pager->n_rows); gtk_label_set_text (GTK_LABEL (pager->label_row_col), pager->orientation == GTK_ORIENTATION_HORIZONTAL ? _("rows") : _("columns")); g_signal_connect (pager->properties_dialog, "destroy", G_CALLBACK (properties_dialog_destroyed), pager); g_signal_connect (pager->properties_dialog, "delete_event", G_CALLBACK (delete_event), pager); g_signal_connect (pager->properties_dialog, "response", G_CALLBACK (response_cb), pager); g_signal_connect (WID ("done_button"), "clicked", (GCallback) close_dialog, pager); gtk_spin_button_set_value (GTK_SPIN_BUTTON (pager->num_workspaces_spin), wnck_screen_get_workspace_count (pager->screen)); g_signal_connect (G_OBJECT (pager->num_workspaces_spin), "value_changed", (GCallback) num_workspaces_value_changed, pager); wncklet_connect_while_alive (pager->screen, "workspace_created", G_CALLBACK(workspace_created), pager, pager->properties_dialog); wncklet_connect_while_alive (pager->screen, "workspace_destroyed", G_CALLBACK(workspace_destroyed), pager, pager->properties_dialog); g_signal_connect (G_OBJECT (pager->workspaces_tree), "focus_out_event", (GCallback) workspaces_tree_focused_out, pager); pager->workspaces_store = gtk_list_store_new (1, G_TYPE_STRING, NULL); update_workspaces_model (pager); gtk_tree_view_set_model (GTK_TREE_VIEW (pager->workspaces_tree), GTK_TREE_MODEL (pager->workspaces_store)); g_object_unref (pager->workspaces_store); cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, "editable", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes ("workspace", cell, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (pager->workspaces_tree), column); g_signal_connect (cell, "edited", (GCallback) workspace_name_edited, pager); nr_ws = wnck_screen_get_workspace_count (pager->screen); for (i = 0; i < nr_ws; i++) { wncklet_connect_while_alive ( G_OBJECT (wnck_screen_get_workspace (pager->screen, i)), "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog); } update_properties_for_wm (pager); }
static void workspace_renamed (WnckWorkspace *space, PagerData *pager) { update_workspaces_model (pager); }