From bcedbfd1a5b85dc8f558adf01577593bdf2263c4 Mon Sep 17 00:00:00 2001 From: Cristian Henzel Date: Fri, 6 May 2011 14:15:48 +0300 Subject: [PATCH] ClipIt-1.4.0-20110506001 + Added: Added option to automatically paste an entry after selecting it. + Fixed: Re-enabled indicator since it should now work properly. Changes to be committed: modified: ChangeLog modified: configure modified: src/main.c modified: src/main.h modified: src/preferences.c modified: src/preferences.h --- ChangeLog | 30 ++++++++++++++++++------------ src/main.c | 11 +++++++++++ src/main.h | 1 + src/preferences.c | 8 ++++++++ src/preferences.h | 1 + 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 611e525..4c66b1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +ClipIt-1.4.0-20110506001 - 06 May. 2011 + + Added: Added option to automatically paste an entry after selecting it. + + Fixed: Re-enabled indicator since it should now work properly. + ClipIt-1.3.13-20110503001 - 03 May. 2011 + Fixed: Bug in the indicator code that makes ClipIt crash X under certain circumstances. @@ -64,25 +68,26 @@ ClipIt-v1.3.3-23112010001 - 23 Nov. 2010 item properly. ClipIt-v1.3.2-22112010001 - 22 Nov. 2010 - + Fixed: Fixed most of the markup and indentation (replaced double spaces - with tabs). - + Fixed: Removed clipboard restoring from history, as this seems to cause - more problems than it solves. + + Fixed: Fixed most of the markup and indentation (replaced double + spaces with tabs). + + Fixed: Removed clipboard restoring from history, as this seems to + cause more problems than it solves. ClipIt-v1.3.1-17112010001 - 17 Nov. 2010 + Added: Added autostart support for LXDE. + Fixed: Fixed problem with "Edit" window not appearing. ClipIt-v1.3.0-14112010001 - 14 Nov. 2010 - + Added: Added "Edit" and "Remove" buttons to the "Manage History" dialog. + + Added: Added "Edit" and "Remove" buttons to the "Manage History" + dialog. + Fixed: Major speed improvements for big history entries while: searching through the history; populating the "Manage History" dialog; generating the popup menus; All of these should now be more than 99% faster, at the expense of an (at most) 1MB overhead. I think it's worth it, though. - + Fixed: Fixed a drawing issue with the small history menu when activated - by clicking on the systray icon. + + Fixed: Fixed a drawing issue with the small history menu when + activated by clicking on the systray icon. ClipIt-v1.2.6-12112010003 - 12 Nov. 2010 + Fixed: Removed reference to pthread.h from configure.in. @@ -91,8 +96,8 @@ ClipIt-v1.2.6-12112010003 - 12 Nov. 2010 ClipIt-v1.2.5-12112010002 - 12 Nov. 2010 + Fixed: Now using autopoint instead of gettextize to avoid waiting for user input. - + Fixed: Added AM_MAINTAINER_MODE, to get rid of the disable-maintainer-mode - warning. + + Fixed: Added AM_MAINTAINER_MODE, to get rid of the + disable-maintainer-mode warning. + Fixed: Fixed a small typo in main.c. + Fixed: removed dependency of pthread.h (the pthread_exit function that we use is also included in glib.h). @@ -135,9 +140,10 @@ ClipIt-v1.0.0-05112010001 - 05 Nov. 2010 + Created "Small history" for quick access to last used items. + Renamed the old history to "Full history". + "Full history" can now hold up to 1000 items. - + Ability to put the button for the "Full history" in the systray - menu. - + Created a Search function, which allows searching through history. + + Ability to put the button for the "Full history" in the + systray menu. + + Created a Search function, which allows searching through + history. + Added Search hotkey. + Created Exceptions: you can enter C or Perl regex into the window and diff --git a/src/main.c b/src/main.c index 73ad3e1..af9f74b 100644 --- a/src/main.c +++ b/src/main.c @@ -256,6 +256,17 @@ static void item_selected(GtkMenuItem *menu_item, gpointer user_data) GSList* element = g_slist_nth(history, GPOINTER_TO_INT(user_data)); gtk_clipboard_set_text(clipboard, (gchar*)element->data, -1); gtk_clipboard_set_text(primary, (gchar*)element->data, -1); + /* Paste the clipboard contents automatically if enabled */ + if (prefs.automatic_paste) { + gchar* cmd = g_strconcat("/bin/sh -c 'xdotool key ctrl+v'", NULL); + GPid pid; + gchar **argv; + g_shell_parse_argv(cmd, NULL, &argv, NULL); + g_free(cmd); + g_spawn_async(NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL); + g_child_watch_add(pid, (GChildWatchFunc)action_exit, NULL); + g_strfreev(argv); + } } /* Clears all local data (specific to main.c) */ diff --git a/src/main.h b/src/main.h index 276fa13..19ea346 100644 --- a/src/main.h +++ b/src/main.h @@ -35,6 +35,7 @@ typedef struct gboolean use_copy; /* Use copy */ gboolean use_primary; /* Use primary */ gboolean synchronize; /* Synchronize copy and primary */ + gboolean automatic_paste; /* Automatically paste entry after selecting it */ gboolean show_indexes; /* Show index numbers in history menu */ gboolean save_uris; /* Save URIs in history */ diff --git a/src/preferences.c b/src/preferences.c index 8f6fc8e..0d17db7 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -32,6 +32,7 @@ GtkWidget *copy_check, *primary_check, *synchronize_check, + *paste_check, *show_indexes_check, *save_uris_check, *history_spin, @@ -74,6 +75,7 @@ static void apply_preferences() prefs.use_copy = gtk_toggle_button_get_active((GtkToggleButton*)copy_check); prefs.use_primary = gtk_toggle_button_get_active((GtkToggleButton*)primary_check); prefs.synchronize = gtk_toggle_button_get_active((GtkToggleButton*)synchronize_check); + prefs.automatic_paste = gtk_toggle_button_get_active((GtkToggleButton*)paste_check); prefs.show_indexes = gtk_toggle_button_get_active((GtkToggleButton*)show_indexes_check); prefs.save_uris = gtk_toggle_button_get_active((GtkToggleButton*)save_uris_check); prefs.save_history = gtk_toggle_button_get_active((GtkToggleButton*)save_check); @@ -108,6 +110,7 @@ static void save_preferences() g_key_file_set_boolean(rc_key, "rc", "use_copy", prefs.use_copy); g_key_file_set_boolean(rc_key, "rc", "use_primary", prefs.use_primary); g_key_file_set_boolean(rc_key, "rc", "synchronize", prefs.synchronize); + g_key_file_set_boolean(rc_key, "rc", "automatic_paste", prefs.automatic_paste); g_key_file_set_boolean(rc_key, "rc", "show_indexes", prefs.show_indexes); g_key_file_set_boolean(rc_key, "rc", "save_uris", prefs.save_uris); g_key_file_set_boolean(rc_key, "rc", "save_history", prefs.save_history); @@ -211,6 +214,7 @@ void read_preferences() prefs.use_copy = g_key_file_get_boolean(rc_key, "rc", "use_copy", NULL); prefs.use_primary = g_key_file_get_boolean(rc_key, "rc", "use_primary", NULL); prefs.synchronize = g_key_file_get_boolean(rc_key, "rc", "synchronize", NULL); + prefs.automatic_paste = g_key_file_get_boolean(rc_key, "rc", "automatic_paste", NULL); prefs.show_indexes = g_key_file_get_boolean(rc_key, "rc", "show_indexes", NULL); prefs.save_uris = g_key_file_get_boolean(rc_key, "rc", "save_uris", NULL); prefs.save_history = g_key_file_get_boolean(rc_key, "rc", "save_history", NULL); @@ -651,6 +655,9 @@ void show_preferences(gint tab) gtk_box_pack_start((GtkBox*)vbox, primary_check, FALSE, FALSE, 0); synchronize_check = gtk_check_button_new_with_mnemonic(_("S_ynchronize clipboards")); gtk_box_pack_start((GtkBox*)vbox, synchronize_check, FALSE, FALSE, 0); + paste_check = gtk_check_button_new_with_mnemonic(_("_Automatically paste selected item")); + g_signal_connect((GObject*)paste_check, "toggled", (GCallback)check_toggled, NULL); + gtk_box_pack_start((GtkBox*)vbox, paste_check, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_settings, frame, FALSE, FALSE, 0); /* Build the miscellaneous frame */ @@ -957,6 +964,7 @@ void show_preferences(gint tab) gtk_toggle_button_set_active((GtkToggleButton*)copy_check, prefs.use_copy); gtk_toggle_button_set_active((GtkToggleButton*)primary_check, prefs.use_primary); gtk_toggle_button_set_active((GtkToggleButton*)synchronize_check, prefs.synchronize); + gtk_toggle_button_set_active((GtkToggleButton*)paste_check, prefs.automatic_paste); gtk_toggle_button_set_active((GtkToggleButton*)show_indexes_check, prefs.show_indexes); gtk_toggle_button_set_active((GtkToggleButton*)save_uris_check, prefs.save_uris); gtk_toggle_button_set_active((GtkToggleButton*)save_check, prefs.save_history); diff --git a/src/preferences.h b/src/preferences.h index 41a9a1a..2997a92 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -32,6 +32,7 @@ G_BEGIN_DECLS #define DEF_USE_COPY TRUE #define DEF_USE_PRIMARY FALSE #define DEF_SYNCHRONIZE FALSE +#define DEF_AUTOMATIC_PASTE FALSE #define DEF_SHOW_INDEXES FALSE #define DEF_SAVE_URIS TRUE #define DEF_SAVE_HISTORY TRUE