[Goodies-commits] r3861 - xfce4-clipman-plugin/trunk/panel-plugin

Mike Massonnet mmassonnet at xfce.org
Thu Jan 24 14:08:34 CET 2008


Author: mmassonnet
Date: 2008-01-24 13:08:34 +0000 (Thu, 24 Jan 2008)
New Revision: 3861

Modified:
   xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.c
   xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.h
   xfce4-clipman-plugin/trunk/panel-plugin/clipman.c
   xfce4-clipman-plugin/trunk/panel-plugin/clipman.h
Log:
More from Nick's notes.
	* panel-plugin/clipman-dialogs.h: Move declarations inside clipman-dialogs.c.
	* panel-plugin/clipman-dialogs.c: Refine the dialog.
	* panel-plugin/clipman-dialogs.c, panel-plugin/clipman.c,
	  panel-plugin/clipman.h: Add "static selection" option.


Modified: xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.c	2008-01-24 13:08:26 UTC (rev 3860)
+++ xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.c	2008-01-24 13:08:34 UTC (rev 3861)
@@ -27,6 +27,35 @@
 
 
 
+#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin"
+
+typedef struct _ClipmanOptions      ClipmanOptions;
+
+struct _ClipmanOptions
+{
+  ClipmanPlugin        *clipman;
+
+  GtkWidget            *ExitSave;
+  GtkWidget            *PreventEmpty;
+  GtkWidget            *IgnoreSelection;
+
+  GtkWidget            *BehaviourNormal;
+  GtkWidget            *BehaviourStrictly;
+
+  GtkWidget            *ItemNumbers;
+
+  GtkWidget            *HistorySize;
+  GtkWidget            *ItemChars;
+
+  GtkWidget            *IgnoreStatic;
+  GtkWidget            *StaticDefault;
+  GtkWidget            *StaticPrimary;
+  GtkWidget            *StaticBoth;
+
+};
+
+
+
 static void                     clipman_configure_response          (GtkWidget *dialog,
                                                                      gint response,
                                                                      ClipmanOptions *options);
@@ -40,213 +69,232 @@
 
 
 void
-clipman_configure_new (ClipmanPlugin *clipman)
+clipman_configure_new (ClipmanPlugin *clipman_plugin)
 {
-  GtkWidget      *dialog, *dialog_vbox, *frame, *button, *label;
-  GtkWidget      *vbox, *hbox, *notebook_vbox, *notebook;
-  ClipmanOptions *options;
-  GSList         *group;
+  GtkWidget            *dialog, *dialog_vbox, *frame, *notebook, *notebook_vbox;
+  GtkWidget            *vbox, *hbox, *button, *label;
+  ClipmanClips         *clipman_clips = clipman_plugin->clipman_clips;
+  ClipmanOptions       *options;
+  GSList               *group;
 
   options = panel_slice_new0 (ClipmanOptions);
-  options->clipman = clipman;
+  options->clipman = clipman_plugin;
 
-  xfce_panel_plugin_block_menu (clipman->panel_plugin);
-
-  dialog = xfce_titled_dialog_new_with_buttons (_("Clipboard Manager"),
-												GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (clipman->panel_plugin))),
-												GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-												GTK_STOCK_HELP, GTK_RESPONSE_HELP,
-												GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-												NULL);
-
+  dialog =
+    xfce_titled_dialog_new_with_buttons (_("Clipboard Manager"),
+                                         GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (clipman_plugin->panel_plugin))),
+                                         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+                                         GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+                                         GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+                                         NULL);
+  gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PASTE);
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-  gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_PASTE);
+  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+  gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
+  gtk_window_stick (GTK_WINDOW (dialog));
 
-  g_object_set_data (G_OBJECT (clipman->panel_plugin), "dialog", dialog);
-
   dialog_vbox = GTK_DIALOG (dialog)->vbox;
 
   notebook = gtk_notebook_new ();
-  gtk_box_pack_start (GTK_BOX (dialog_vbox), notebook, FALSE, TRUE, 0);
-  gtk_container_set_border_width (GTK_CONTAINER (notebook), BORDER-3);
+  gtk_box_pack_start (GTK_BOX (dialog_vbox), notebook, TRUE, TRUE, 0);
+  gtk_container_set_border_width (GTK_CONTAINER (notebook), BORDER-2);
 
+  /* === General === */
   notebook_vbox = gtk_vbox_new (FALSE, 2);
   gtk_container_add (GTK_CONTAINER (notebook), notebook_vbox);
 
-  /**
-   * The general frame
-   **/
+  gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook),
+                                   gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0),
+                                   _("General"));
+
+  /* General */
   vbox = gtk_vbox_new (FALSE, 2);
-
-  frame = xfce_create_framebox_with_content (_("Configuration"), vbox);
+  frame = xfce_create_framebox_with_content (_("General"), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
 
-  button = options->ExitSave = gtk_check_button_new_with_mnemonic (_("Save clipboard contents on _exit"));
+  button = options->ExitSave =
+    gtk_check_button_new_with_mnemonic (_("Save clipboard contents on _exit"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->save_on_exit);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman->clipman_clips->save_on_exit);
   g_signal_connect (G_OBJECT (button), "toggled",
-					G_CALLBACK (toggle_button), options);
+                    G_CALLBACK (toggle_button), options);
 
-  button = options->PreventEmpty = gtk_check_button_new_with_mnemonic (_("Pre_vent empty clipboard"));
+  button = options->PreventEmpty =
+    gtk_check_button_new_with_mnemonic (_("Pre_vent empty clipboard"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->prevent_empty);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman->clipman_clips->prevent_empty);
   g_signal_connect (G_OBJECT (button), "toggled",
-					G_CALLBACK (toggle_button), options);
+                    G_CALLBACK (toggle_button), options);
 
-  button = options->IgnoreSelection = gtk_check_button_new_with_mnemonic (_("_Ignore selections"));
+  button = options->IgnoreSelection =
+    gtk_check_button_new_with_mnemonic (_("_Ignore selections"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->ignore_primary);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman->clipman_clips->ignore_primary);
   g_signal_connect (G_OBJECT (button), "toggled",
-					G_CALLBACK (toggle_button), options);
+                    G_CALLBACK (toggle_button), options);
 
-  button = options->IgnoreStatic = gtk_check_button_new_with_mnemonic (_("_Ignore static clipboard"));
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman->clipman_clips->ignore_static_clipboard);
-  g_signal_connect (G_OBJECT (button), "toggled",
-					G_CALLBACK (toggle_button), options);
-
-  label = gtk_label_new (_("<b>General</b>"));
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_misc_set_padding (GTK_MISC (label), 2, 0);
-
-  /**
-   * separate clipboards frame
-   **/
+  /* Behavior */
   vbox = gtk_vbox_new (FALSE, 2);
-
-  frame = xfce_create_framebox_with_content (_("Configuration"), vbox);
+  frame = xfce_create_framebox_with_content (_("Clipboard Behavior"), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
 
   group = NULL;
 
-  button = options->Behaviour = gtk_radio_button_new_with_mnemonic (group, _("Normal clipboard _management"));
-  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
+  button = options->BehaviourNormal =
+    gtk_radio_button_new_with_mnemonic (group, _("Normal clipboard _management"));
   gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), group);
   group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-
-  if(clipman->clipman_clips->behavior == NORMAL)
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
-  button = gtk_radio_button_new_with_mnemonic (group, _("Strictly separate _both clipboards"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->behavior == NORMAL);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
 
+  button = options->BehaviourStrictly =
+    gtk_radio_button_new_with_mnemonic (group, _("Strictly separate _both clipboards"));
   gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), group);
   group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->behavior == STRICTLY);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
 
-  if(clipman->clipman_clips->behavior == STRICTLY)
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
-  label = gtk_label_new (_("<b>Clipboard Behaviour</b>"));
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_misc_set_padding (GTK_MISC (label), 2, 0);
-
-  /**
-   * Notebook label
-   **/
-  label = gtk_label_new (_("General"));
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), label);
-
+  /* === Appearance === */
   notebook_vbox = gtk_vbox_new (FALSE, 2);
   gtk_container_add (GTK_CONTAINER (notebook), notebook_vbox);
 
-  /**
-   * Menu appearance frame
-   **/
+  gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook),
+                                   gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1),
+                                   _("Appearance"));
+
+  /* Appearance */
   vbox = gtk_vbox_new (FALSE, 2);
-
-  frame = xfce_create_framebox_with_content (_("Configuration"), vbox);
+  frame = xfce_create_framebox_with_content (_("Menu Appearance"), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
 
   button = options->ItemNumbers = gtk_check_button_new_with_mnemonic (_("_Show item numbers"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_plugin->menu_item_show_number);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman->menu_item_show_number);
-
   g_signal_connect (G_OBJECT (button), "toggled",
-					G_CALLBACK (toggle_button), options);
+                    G_CALLBACK (toggle_button), options);
 
-  label = gtk_label_new (_("<b>Menu Appearance</b>"));
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_misc_set_padding (GTK_MISC (label), 2, 0);
-
-  /**
-   * Call some functions
-   **/
-
-  toggle_button (options->IgnoreSelection, options);
-
-  /**
-   * Numbers frame
-   **/
+  /* Numbers */
   vbox = gtk_vbox_new (FALSE, 2);
-
-  frame = xfce_create_framebox_with_content (_("Configuration"), vbox);
+  frame = xfce_create_framebox_with_content (_("Numbers"), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
 
+  /* History length */
   label = gtk_label_new (_("Clipboard history items:"));
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
 
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
 
-  button = options->HistorySize = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (clipman->clipman_clips->history_length, MINHISTORY, MAXHISTORY, 1, 5, 0)));
-  gtk_widget_show (button);
-  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 10);
+  button = options->HistorySize =
+    gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (clipman_clips->history_length,
+                                                        MINHISTORY, MAXHISTORY, 1, 5, 0)));
   gtk_scale_set_draw_value (GTK_SCALE (button), FALSE);
   gtk_scale_set_digits (GTK_SCALE (button), 0);
+  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 10);
 
-  button = gtk_spin_button_new_with_range(MINHISTORY, MAXHISTORY, 1);
+  button = gtk_spin_button_new_with_range (MINHISTORY, MAXHISTORY, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), clipman_clips->history_length);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
-  gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), clipman->clipman_clips->history_length);
 
-  /* Sync history widgets */
   g_signal_connect (G_OBJECT (options->HistorySize), "value_changed",
-					G_CALLBACK (set_scale_to_spin), button);
-
+                    G_CALLBACK (set_scale_to_spin), button);
   g_signal_connect (G_OBJECT (button), "value_changed",
-					G_CALLBACK (set_spin_to_scale), options->HistorySize);
+                    G_CALLBACK (set_spin_to_scale), options->HistorySize);
 
+  /* Max menu item chars */
   label = gtk_label_new (_("Menu item characters:"));
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
 
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
 
-  button = options->ItemChars = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (clipman->menu_item_max_chars, MINCHARS, MAXCHARS, 1, 5, 0)));
-  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 10);
+  button = options->ItemChars =
+    gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (clipman_plugin->menu_item_max_chars,
+                                                        MINCHARS, MAXCHARS, 1, 5, 0)));
   gtk_scale_set_draw_value (GTK_SCALE (button), FALSE);
   gtk_scale_set_digits (GTK_SCALE (button), 0);
+  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 10);
 
-  button = gtk_spin_button_new_with_range(MINCHARS, MAXCHARS, 1);
+  button = gtk_spin_button_new_with_range (MINCHARS, MAXCHARS, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), clipman_plugin->menu_item_max_chars);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
-  gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), clipman->menu_item_max_chars);
 
   g_signal_connect (G_OBJECT (options->ItemChars), "value_changed",
-					G_CALLBACK (set_scale_to_spin), button);
-
+                    G_CALLBACK (set_scale_to_spin), button);
   g_signal_connect (G_OBJECT (button), "value_changed",
-					G_CALLBACK (set_spin_to_scale), options->ItemChars);
+                    G_CALLBACK (set_spin_to_scale), options->ItemChars);
 
-  label = gtk_label_new (_("<b>Numbers</b>"));
-  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_misc_set_padding (GTK_MISC (label), 4, 0);
 
-  label = gtk_label_new (_("Appearance"));
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label);
+  /* === Static clipboard === */
+  notebook_vbox = gtk_vbox_new (FALSE, 2);
+  gtk_container_add (GTK_CONTAINER (notebook), notebook_vbox);
 
+  gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (notebook),
+                                   gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2),
+                                   _("Static Clipboard"));
+
+  /* General */
+  vbox = gtk_vbox_new (FALSE, 2);
+  frame = xfce_create_framebox_with_content (_("General"), vbox);
+  gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
+  gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
+
+  button = options->IgnoreStatic =
+    gtk_check_button_new_with_mnemonic (_("Ignore _static clipboard"));
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->ignore_static_clipboard);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
+
+  /* Copy to clipboard */
+  vbox = gtk_vbox_new (FALSE, 2);
+  frame = xfce_create_framebox_with_content (_("Select to Clipboards"), vbox);
+  gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
+  gtk_box_pack_start (GTK_BOX (notebook_vbox), frame, FALSE, TRUE, 0);
+
+  group = NULL;
+
+  button = options->StaticDefault =
+    gtk_radio_button_new_with_mnemonic (group, _("Default"));
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), group);
+  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->static_selection == DEFAULT);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
+
+  button = options->StaticPrimary =
+    gtk_radio_button_new_with_mnemonic (group, _("Selection"));
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), group);
+  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->static_selection == PRIMARY);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
+
+  button = options->StaticBoth =
+    gtk_radio_button_new_with_mnemonic (group, _("Both"));
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), group);
+  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clipman_clips->static_selection == BOTH);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (toggle_button), options);
+
+  /* Show the stuff */
   g_signal_connect (dialog, "response",
-				   G_CALLBACK (clipman_configure_response), options);
-
+                    G_CALLBACK (clipman_configure_response), options);
+  xfce_panel_plugin_block_menu (clipman_plugin->panel_plugin);
   gtk_widget_show_all (dialog);
 }
 
@@ -270,14 +318,6 @@
 
   DBG("Destroy the dialog");
 
-  g_object_set_data (G_OBJECT (options->clipman->panel_plugin), "dialog", NULL);
-
-  /* Behavior */
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (options->Behaviour)))
-	options->clipman->clipman_clips->behavior = NORMAL;
-  else
-	options->clipman->clipman_clips->behavior = STRICTLY;
-
   /* History length */
   gint history_length = gtk_range_get_value (GTK_RANGE (options->HistorySize));
   if (options->clipman->clipman_clips->history_length != history_length)
@@ -318,9 +358,7 @@
     }
 
   xfce_panel_plugin_unblock_menu (options->clipman->panel_plugin);
-
   gtk_widget_destroy (dialog);
-
   panel_slice_free (ClipmanOptions, options);
 }
 
@@ -346,24 +384,58 @@
 toggle_button (GtkWidget *button,
                ClipmanOptions *options)
 {
-  if (button == options->ExitSave)
-    options->clipman->clipman_clips->save_on_exit =
+  ClipmanPlugin        *clipman_plugin = options->clipman;
+  ClipmanClips         *clipman_clips = clipman_plugin->clipman_clips;
+
+  if (button == options->ItemNumbers)
+    clipman_plugin->menu_item_show_number =
       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
+  else if (button == options->ExitSave)
+    clipman_clips->save_on_exit =
+      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
   else if (button == options->PreventEmpty)
-    options->clipman->clipman_clips->prevent_empty =
+    clipman_clips->prevent_empty =
       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
   else if (button == options->IgnoreSelection)
-    options->clipman->clipman_clips->ignore_primary =
+    clipman_clips->ignore_primary =
       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
   else if (button == options->IgnoreStatic)
-    options->clipman->clipman_clips->ignore_static_clipboard =
+    clipman_clips->ignore_static_clipboard =
       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
-  else if (button == options->ItemNumbers)
-    options->clipman->menu_item_show_number =
-      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+  else if (button == options->BehaviourNormal)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+        clipman_clips->behavior = NORMAL;
+    }
+
+  else if (button == options->BehaviourStrictly)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+        clipman_clips->behavior = STRICTLY;
+    }
+
+  else if (button == options->StaticDefault)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+        clipman_clips->static_selection = DEFAULT;
+    }
+
+  else if (button == options->StaticPrimary)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+        clipman_clips->static_selection = PRIMARY;
+    }
+
+  else if (button == options->StaticBoth)
+    {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+        clipman_clips->static_selection = BOTH;
+    }
+
 }
 

Modified: xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.h
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.h	2008-01-24 13:08:26 UTC (rev 3860)
+++ xfce4-clipman-plugin/trunk/panel-plugin/clipman-dialogs.h	2008-01-24 13:08:34 UTC (rev 3861)
@@ -23,28 +23,6 @@
 
 G_BEGIN_DECLS
 
-#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin"
-
-typedef struct _ClipmanOptions      ClipmanOptions;
-
-struct _ClipmanOptions
-{
-  ClipmanPlugin        *clipman;
-
-  GtkWidget            *ExitSave;
-  GtkWidget            *PreventEmpty;
-  GtkWidget            *IgnoreSelection;
-  GtkWidget            *IgnoreStatic;
-
-  GtkWidget            *Behaviour;
-
-  GtkWidget            *ItemNumbers;
-  GtkWidget            *SeparateMenu;
-
-  GtkWidget            *HistorySize;
-  GtkWidget            *ItemChars;
-};
-
 void
 clipman_configure_new (ClipmanPlugin *clipman_plugin);
 

Modified: xfce4-clipman-plugin/trunk/panel-plugin/clipman.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/clipman.c	2008-01-24 13:08:26 UTC (rev 3860)
+++ xfce4-clipman-plugin/trunk/panel-plugin/clipman.c	2008-01-24 13:08:34 UTC (rev 3861)
@@ -177,11 +177,12 @@
     length = MINCHARS;
   clipman_plugin->menu_item_max_chars = length;
 
-  clipman_clips->behavior       = xfce_rc_read_int_entry    (rc, "Behaviour", NORMAL);
-  clipman_clips->save_on_exit   = xfce_rc_read_bool_entry   (rc, "ExitSave", DEFEXITSAVE);
-  clipman_clips->prevent_empty  = xfce_rc_read_bool_entry   (rc, "PreventEmpty", DEFPREVENTEMPTY);
-  clipman_clips->ignore_primary = xfce_rc_read_bool_entry   (rc, "IgnoreSelect", DEFIGNORESELECT);
-  clipman_clips->ignore_static_clipboard = xfce_rc_read_bool_entry (rc, "IgnoreStatic", DEFIGNORESTATIC);
+  clipman_clips->behavior                   = xfce_rc_read_int_entry    (rc, "Behaviour", NORMAL);
+  clipman_clips->save_on_exit               = xfce_rc_read_bool_entry   (rc, "ExitSave", DEFEXITSAVE);
+  clipman_clips->prevent_empty              = xfce_rc_read_bool_entry   (rc, "PreventEmpty", DEFPREVENTEMPTY);
+  clipman_clips->ignore_primary             = xfce_rc_read_bool_entry   (rc, "IgnoreSelect", DEFIGNORESELECT);
+  clipman_clips->ignore_static_clipboard    = xfce_rc_read_bool_entry	(rc, "IgnoreStatic", DEFIGNORESTATIC);
+  clipman_clips->static_selection           = xfce_rc_read_int_entry    (rc, "StaticSelection", PRIMARY);
 
   length = xfce_rc_read_int_entry (rc, "HistoryItems", DEFHISTORY);
   if (length > MAXHISTORY)
@@ -256,6 +257,7 @@
   xfce_rc_write_bool_entry  (rc, "PreventEmpty",    clipman_clips->prevent_empty);
   xfce_rc_write_bool_entry  (rc, "IgnoreSelect",    clipman_clips->ignore_primary);
   xfce_rc_write_bool_entry  (rc, "IgnoreStatic",    clipman_clips->ignore_static_clipboard);
+  xfce_rc_write_int_entry   (rc, "StaticSelection", clipman_clips->static_selection);
 
   xfce_rc_delete_group (rc, "Clips", TRUE);
 
@@ -750,8 +752,12 @@
     }
   else
     {
-      gtk_clipboard_set_text (clipman_plugin->clipman_clips->default_clipboard, clip->text, -1);
-      if (!clipman_plugin->clipman_clips->ignore_primary)
+      StaticSelection static_selection = clipman_plugin->clipman_clips->static_selection;
+
+      if (static_selection == DEFAULT || static_selection == BOTH)
+        gtk_clipboard_set_text (clipman_plugin->clipman_clips->default_clipboard, clip->text, -1);
+
+      if (static_selection == PRIMARY || static_selection == BOTH)
         gtk_clipboard_set_text (clipman_plugin->clipman_clips->primary_clipboard, clip->text, -1);
     }
 }

Modified: xfce4-clipman-plugin/trunk/panel-plugin/clipman.h
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/clipman.h	2008-01-24 13:08:26 UTC (rev 3860)
+++ xfce4-clipman-plugin/trunk/panel-plugin/clipman.h	2008-01-24 13:08:34 UTC (rev 3861)
@@ -61,6 +61,13 @@
 
 typedef enum
 {
+  /* DEFAULT,
+   * PRIMARY, */
+  BOTH = 2
+} StaticSelection;
+
+typedef enum
+{
   NORMAL,
   STRICTLY
 } ClipboardBehavior;
@@ -101,6 +108,7 @@
   gboolean              prevent_empty;
   gboolean              ignore_primary;
   gboolean              ignore_static_clipboard;
+  StaticSelection       static_selection;
 };
 
 struct _ClipmanClip




More information about the Goodies-commits mailing list