static void show_desktop_applet_realized(MatePanelApplet* applet, gpointer data) { ShowDesktopData* sdd; GdkScreen* screen; sdd = (ShowDesktopData*) data; if (sdd->matewnck_screen != NULL) g_signal_handlers_disconnect_by_func(sdd->matewnck_screen, show_desktop_changed_callback, sdd); if (sdd->icon_theme != NULL) g_signal_handlers_disconnect_by_func(sdd->icon_theme, theme_changed_callback, sdd); screen = gtk_widget_get_screen(sdd->applet); sdd->matewnck_screen = matewnck_screen_get(gdk_screen_get_number (screen)); if (sdd->matewnck_screen != NULL) wncklet_connect_while_alive(sdd->matewnck_screen, "showing_desktop_changed", G_CALLBACK(show_desktop_changed_callback), sdd, sdd->applet); else g_warning("Could not get MatewnckScreen!"); show_desktop_changed_callback(sdd->matewnck_screen, sdd); sdd->icon_theme = gtk_icon_theme_get_for_screen (screen); wncklet_connect_while_alive(sdd->icon_theme, "changed", G_CALLBACK(theme_changed_callback), sdd, sdd->applet); update_icon (sdd); }
static void wnck_selector_connect_to_window (WnckSelector *selector, WnckWindow *window) { wncklet_connect_while_alive (window, "icon_changed", G_CALLBACK (wnck_selector_window_icon_changed), selector, selector); wncklet_connect_while_alive (window, "name_changed", G_CALLBACK (wnck_selector_window_name_changed), selector, selector); wncklet_connect_while_alive (window, "state_changed", G_CALLBACK (wnck_selector_window_state_changed), selector, selector); wncklet_connect_while_alive (window, "workspace_changed", G_CALLBACK (wnck_selector_window_workspace_changed), selector, selector); }
static void wnck_selector_add_workspace (WnckSelector *selector, WnckScreen *screen, int workspace_n) { WnckWorkspace *workspace; GtkWidget *item; GtkWidget *label; workspace = wnck_screen_get_workspace (screen, workspace_n); /* We use a separator in which we add a label. This makes the menu item not * selectable without any hack. */ item = gtk_separator_menu_item_new (); label = gtk_label_new (""); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_widget_show (label); /* the handler will also take care of setting the name for the first time, * and we'll be able to adapt to theme changes */ g_signal_connect (G_OBJECT (label), "style-updated", G_CALLBACK (wnck_selector_workspace_label_style_updated), workspace); wncklet_connect_while_alive (workspace, "name_changed", G_CALLBACK (wnck_selector_workspace_name_changed), label, label); gtk_container_add (GTK_CONTAINER (item), label); gtk_menu_shell_append (GTK_MENU_SHELL (selector->priv->menu), item); g_object_set_data (G_OBJECT (item), "wnck-selector-workspace-n", GINT_TO_POINTER (workspace_n + 1)); }
static void applet_realized(MatePanelApplet* applet, PagerData* pager) { pager->screen = wncklet_get_screen(GTK_WIDGET(applet)); window_manager_changed(pager->screen, pager); wncklet_connect_while_alive(pager->screen, "window_manager_changed", G_CALLBACK(window_manager_changed), pager, pager->applet); }
static void bigboard_button_applet_realized (PanelApplet *applet, gpointer data) { ButtonData *button_data; GdkScreen *screen; button_data = (ButtonData *) data; if (button_data->icon_theme != NULL) g_signal_handlers_disconnect_by_func (button_data->icon_theme, theme_changed_callback, button_data); screen = gtk_widget_get_screen (button_data->applet); button_data->icon_theme = gtk_icon_theme_get_for_screen (screen); wncklet_connect_while_alive (button_data->icon_theme, "changed", G_CALLBACK (theme_changed_callback), button_data, button_data->applet); button_data->suppress_popout_set = TRUE; update_button_state (button_data); button_data->suppress_popout_set = FALSE; }
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 wnck_selector_connect_to_screen (WnckSelector *selector, WnckScreen *screen) { wncklet_connect_while_alive (screen, "active_window_changed", G_CALLBACK (wnck_selector_active_window_changed), selector, selector); wncklet_connect_while_alive (screen, "window_opened", G_CALLBACK (wnck_selector_window_opened), selector, selector); wncklet_connect_while_alive (screen, "window_closed", G_CALLBACK (wnck_selector_window_closed), selector, selector); wncklet_connect_while_alive (screen, "workspace_created", G_CALLBACK (wnck_selector_workspace_created), selector, selector); wncklet_connect_while_alive (screen, "workspace_destroyed", G_CALLBACK (wnck_selector_workspace_destroyed), selector, selector); }
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); }