diff -uNr xfce4-panel-4.6.2/plugins/pager/pager.c xfce4-panel-4.6.2p/plugins/pager/pager.c --- xfce4-panel-4.6.2/plugins/pager/pager.c 2009-10-16 17:18:49.000000000 +0400 +++ xfce4-panel-4.6.2p/plugins/pager/pager.c 2010-04-19 17:53:23.000000000 +0400 @@ -49,6 +49,7 @@ gint rows; guint scrolling : 1; guint show_names : 1; + guint wrap_workspaces : 1; } Pager; @@ -132,8 +133,9 @@ XfceRc *rc; int rows = 1; gboolean scrolling = TRUE; + gboolean wrap_workspaces = TRUE; gboolean show_names = FALSE; - + if ((file = xfce_panel_plugin_lookup_rc_file (plugin)) != NULL) { rc = xfce_rc_simple_open (file, TRUE); @@ -143,12 +145,14 @@ { rows = xfce_rc_read_int_entry (rc, "rows", 1); scrolling = xfce_rc_read_bool_entry (rc, "scrolling", TRUE); + wrap_workspaces = xfce_rc_read_bool_entry (rc, "wrap-workspaces", TRUE); show_names = xfce_rc_read_bool_entry (rc, "show-names", FALSE); } } pager->rows = rows; pager->scrolling = scrolling; + pager->wrap_workspaces = wrap_workspaces; pager->show_names = show_names; } @@ -170,6 +174,8 @@ xfce_rc_write_int_entry (rc, "rows", pager->rows); xfce_rc_write_bool_entry (rc, "scrolling", pager->scrolling); + + xfce_rc_write_bool_entry (rc, "wrap-workspaces", pager->wrap_workspaces); xfce_rc_write_bool_entry (rc, "show-names", pager->show_names); @@ -273,6 +279,7 @@ xfce_panel_plugin_get_orientation (plugin)); wnck_pager_set_n_rows (WNCK_PAGER (pager->pager), pager->rows); xfce_pager_set_workspace_scrolling (XFCE_PAGER (pager->pager), pager->scrolling); + xfce_pager_set_wrap_workspaces (XFCE_PAGER (pager->pager), pager->wrap_workspaces); wnck_pager_set_display_mode (WNCK_PAGER (pager->pager), pager->show_names ? WNCK_PAGER_DISPLAY_NAME : WNCK_PAGER_DISPLAY_CONTENT); @@ -333,6 +340,18 @@ } } +wrap_workspaces_toggled (GtkWidget *button, Pager *pager) +{ + gboolean wrap_workspaces = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); + + if (pager->wrap_workspaces != wrap_workspaces) + { + pager->wrap_workspaces = wrap_workspaces; + + xfce_pager_set_wrap_workspaces (XFCE_PAGER (pager->pager), wrap_workspaces); + } +} + static void workspace_show_names_toggled (GtkWidget *button, Pager *pager) { @@ -360,7 +379,7 @@ static void pager_properties_dialog (XfcePanelPlugin *plugin, Pager *pager) { - GtkWidget *dlg, *vbox, *hbox, *label, *spin, *scrolling, *show_names; + GtkWidget *dlg, *vbox, *hbox, *label, *spin, *scrolling, *show_names, *wrap_workspaces; gint max; xfce_panel_plugin_block_menu (plugin); @@ -423,6 +442,14 @@ g_signal_connect (scrolling, "toggled", G_CALLBACK (workspace_scrolling_toggled), pager); + wrap_workspaces = gtk_check_button_new_with_mnemonic (_("Wrap workspaces when the _first or the last workspace is reached")); + gtk_widget_show (wrap_workspaces); + gtk_box_pack_start (GTK_BOX (vbox), wrap_workspaces, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wrap_workspaces), pager->wrap_workspaces); + + g_signal_connect (wrap_workspaces, "toggled", + G_CALLBACK (wrap_workspaces_toggled), pager); + show_names = gtk_check_button_new_with_mnemonic (_("Show workspace _names")); gtk_widget_show (show_names); gtk_box_pack_start (GTK_BOX (vbox), show_names, FALSE, FALSE, 0); diff -uNr xfce4-panel-4.6.2/plugins/pager/xfce-pager.c xfce4-panel-4.6.2p/plugins/pager/xfce-pager.c --- xfce4-panel-4.6.2/plugins/pager/xfce-pager.c 2009-10-16 17:18:49.000000000 +0400 +++ xfce4-panel-4.6.2p/plugins/pager/xfce-pager.c 2010-04-19 17:57:04.000000000 +0400 @@ -35,6 +35,7 @@ { WnckScreen *screen; guint workspace_scrolling : 1; + guint wrap_workspaces : 1; }; @@ -116,7 +117,12 @@ pager->priv->workspace_scrolling = scrolling; } - +void +xfce_pager_set_wrap_workspaces (XfcePager *pager, + gboolean wrap_workspaces) +{ + pager->priv->wrap_workspaces = wrap_workspaces; +} static gboolean xfce_pager_scroll_event (GtkWidget *widget, @@ -147,10 +153,14 @@ { ws = wnck_screen_get_workspace (screen, active - 1); } - else + else if(pager->priv->wrap_workspaces) { ws = wnck_screen_get_workspace (screen, n - 1); } + else + { + ws = wnck_screen_get_workspace (screen, active); + } wnck_workspace_activate (ws, 0); break; @@ -160,10 +170,14 @@ { ws = wnck_screen_get_workspace (screen, active + 1); } - else + else if(pager->priv->wrap_workspaces) { ws = wnck_screen_get_workspace (screen, 0); } + else + { + ws = wnck_screen_get_workspace (screen, active); + } wnck_workspace_activate (ws, 0); break; diff -uNr xfce4-panel-4.6.2/plugins/pager/xfce-pager.h xfce4-panel-4.6.2p/plugins/pager/xfce-pager.h --- xfce4-panel-4.6.2/plugins/pager/xfce-pager.h 2009-10-16 17:18:49.000000000 +0400 +++ xfce4-panel-4.6.2p/plugins/pager/xfce-pager.h 2010-04-19 17:46:14.000000000 +0400 @@ -48,4 +48,7 @@ void xfce_pager_set_workspace_scrolling (XfcePager *pager, gboolean scrolling); +void xfce_pager_set_wrap_workspaces (XfcePager *pager, + gboolean wrap_workspaces); + #endif /* __XFCE_PAGER_H__ */