diff --git a/ChangeLog b/ChangeLog index 6097411..456bd3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +ClipIt-v1.3.11-22122010001 - 22 Dec. 2010 + + Fixed: Indicator menu now actually refreshes properly. + + Fixed: Removed "Full history" and changed the wording in the + "Preferences" dialog. + + Fixed: Imported "Select first item in menu" fix from Parcellite 0.9.3. + ClipIt-v1.3.10-21122010001 - 21 Dec. 2010 + Fixed: Imported fixes from Parcellite 0.9.3 (thanks to Doug Springer). + Fixed: Fixed cast warnings when building on x86 machines. diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index 404ce83..bea780e 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.67 for clipit 1.3.10. +@%:@ Generated by GNU Autoconf 2.67 for clipit 1.3.11. @%:@ @%:@ Report bugs to . @%:@ @@ -552,8 +552,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='clipit' PACKAGE_TARNAME='clipit' -PACKAGE_VERSION='1.3.10' -PACKAGE_STRING='clipit 1.3.10' +PACKAGE_VERSION='1.3.11' +PACKAGE_STRING='clipit 1.3.11' PACKAGE_BUGREPORT='oss@rspwn.com' PACKAGE_URL='' @@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures clipit 1.3.10 to adapt to many kinds of systems. +\`configure' configures clipit 1.3.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of clipit 1.3.10:";; + short | recursive ) echo "Configuration of clipit 1.3.11:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -clipit configure 1.3.10 +clipit configure 1.3.11 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1880,7 +1880,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by clipit $as_me 1.3.10, which was +It was created by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2696,7 +2696,7 @@ fi # Define the identity of the package. PACKAGE=clipit - VERSION=1.3.10 + VERSION=1.3.11 cat >>confdefs.h <<_ACEOF @@ -9764,7 +9764,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by clipit $as_me 1.3.10, which was +This file was extended by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9830,7 +9830,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -clipit config.status 1.3.10 +clipit config.status 1.3.11 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index 404ce83..bea780e 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -1,6 +1,6 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.67 for clipit 1.3.10. +@%:@ Generated by GNU Autoconf 2.67 for clipit 1.3.11. @%:@ @%:@ Report bugs to . @%:@ @@ -552,8 +552,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='clipit' PACKAGE_TARNAME='clipit' -PACKAGE_VERSION='1.3.10' -PACKAGE_STRING='clipit 1.3.10' +PACKAGE_VERSION='1.3.11' +PACKAGE_STRING='clipit 1.3.11' PACKAGE_BUGREPORT='oss@rspwn.com' PACKAGE_URL='' @@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures clipit 1.3.10 to adapt to many kinds of systems. +\`configure' configures clipit 1.3.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of clipit 1.3.10:";; + short | recursive ) echo "Configuration of clipit 1.3.11:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -clipit configure 1.3.10 +clipit configure 1.3.11 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1880,7 +1880,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by clipit $as_me 1.3.10, which was +It was created by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2696,7 +2696,7 @@ fi # Define the identity of the package. PACKAGE=clipit - VERSION=1.3.10 + VERSION=1.3.11 cat >>confdefs.h <<_ACEOF @@ -9764,7 +9764,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by clipit $as_me 1.3.10, which was +This file was extended by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9830,7 +9830,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -clipit config.status 1.3.10 +clipit config.status 1.3.11 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/autom4te.cache/traces.1 b/autom4te.cache/traces.1 index fecbf40..788aed1 100644 --- a/autom4te.cache/traces.1 +++ b/autom4te.cache/traces.1 @@ -8,7 +8,7 @@ m4trace:aclocal.m4:2010: -1- m4_include([m4/lib-prefix.m4]) m4trace:aclocal.m4:2011: -1- m4_include([m4/nls.m4]) m4trace:aclocal.m4:2012: -1- m4_include([m4/po.m4]) m4trace:aclocal.m4:2013: -1- m4_include([m4/progtest.m4]) -m4trace:configure.in:5: -1- AC_INIT([clipit], [1.3.10], [oss@rspwn.com]) +m4trace:configure.in:5: -1- AC_INIT([clipit], [1.3.11], [oss@rspwn.com]) m4trace:configure.in:5: -1- m4_pattern_forbid([^_?A[CHUM]_]) m4trace:configure.in:5: -1- m4_pattern_forbid([_AC_]) m4trace:configure.in:5: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) diff --git a/configure b/configure index 56f47e6..f138d61 100644 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for clipit 1.3.10. +# Generated by GNU Autoconf 2.67 for clipit 1.3.11. # # Report bugs to . # @@ -552,8 +552,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='clipit' PACKAGE_TARNAME='clipit' -PACKAGE_VERSION='1.3.10' -PACKAGE_STRING='clipit 1.3.10' +PACKAGE_VERSION='1.3.11' +PACKAGE_STRING='clipit 1.3.11' PACKAGE_BUGREPORT='oss@rspwn.com' PACKAGE_URL='' @@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures clipit 1.3.10 to adapt to many kinds of systems. +\`configure' configures clipit 1.3.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of clipit 1.3.10:";; + short | recursive ) echo "Configuration of clipit 1.3.11:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -clipit configure 1.3.10 +clipit configure 1.3.11 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1880,7 +1880,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by clipit $as_me 1.3.10, which was +It was created by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2696,7 +2696,7 @@ fi # Define the identity of the package. PACKAGE=clipit - VERSION=1.3.10 + VERSION=1.3.11 cat >>confdefs.h <<_ACEOF @@ -9764,7 +9764,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by clipit $as_me 1.3.10, which was +This file was extended by clipit $as_me 1.3.11, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9830,7 +9830,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -clipit config.status 1.3.10 +clipit config.status 1.3.11 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 470f842..7b5a72a 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # Autoconf/automake. # ------------------------------------------------------------------------------- AC_PREREQ([2.5]) -AC_INIT([clipit], [1.3.10], [oss@rspwn.com]) +AC_INIT([clipit], [1.3.11], [oss@rspwn.com]) AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/src/history.c b/src/history.c index b9cba00..5ef6274 100644 --- a/src/history.c +++ b/src/history.c @@ -19,6 +19,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/src/main.c b/src/main.c index 2eaea1c..b0b9fec 100644 --- a/src/main.c +++ b/src/main.c @@ -57,11 +57,11 @@ static gboolean actions_lock = FALSE; /* Init preferences structure */ prefs_t prefs = {DEF_USE_COPY, DEF_USE_PRIMARY, DEF_SYNCHRONIZE, DEF_SHOW_INDEXES, DEF_SAVE_URIS, DEF_SAVE_HISTORY, - DEF_HISTORY_LIMIT, DEF_SMALL_HISTORY, DEF_HISTORY_SMALL, - DEF_HYPERLINKS_ONLY, DEF_CONFIRM_CLEAR, DEF_FULL_HIST_BUTTON, - DEF_SINGLE_LINE, DEF_REVERSE_HISTORY, DEF_ITEM_LENGTH, - DEF_ELLIPSIZE, INIT_HISTORY_KEY, INIT_ACTIONS_KEY, - INIT_MENU_KEY, INIT_SEARCH_KEY, DEF_NO_ICON}; + DEF_HISTORY_LIMIT, DEF_ITEMS_MENU, DEF_HYPERLINKS_ONLY, + DEF_CONFIRM_CLEAR, DEF_SINGLE_LINE, DEF_REVERSE_HISTORY, + DEF_ITEM_LENGTH, DEF_ELLIPSIZE, INIT_HISTORY_KEY, + INIT_ACTIONS_KEY, INIT_MENU_KEY, INIT_SEARCH_KEY, + DEF_NO_ICON}; /* Called every CHECK_INTERVAL seconds to check for new items */ static gboolean item_check(gpointer data) @@ -465,96 +465,8 @@ static gboolean show_actions_menu(gpointer data) return FALSE; } -static gboolean show_history_menu_full(gpointer data) -{ - /* Declare some variables */ - GtkWidget *menu, *menu_item, *item_label; - - /* Create the menu */ - menu = gtk_menu_new(); - g_signal_connect((GObject*)menu, "selection-done", (GCallback)gtk_widget_destroy, NULL); - /* Items */ - if ((history != NULL) && (history->data != NULL)) - { - /* Declare some variables */ - GSList* element; - gint element_number = 0; - gchar* primary_temp = gtk_clipboard_wait_for_text(primary); - gchar* clipboard_temp = gtk_clipboard_wait_for_text(clipboard); - /* Reverse history if enabled */ - if (prefs.reverse_history) - { - history = g_slist_reverse(history); - element_number = g_slist_length(history) - 1; - } - /* Go through each element and adding each */ - for (element = history; element != NULL; element = element->next) - { - GString* string = g_string_new((gchar*)element->data); - /* Ellipsize text */ - string = ellipsize_string(string); - /* Remove control characters */ - string = remove_newlines_string(string); - /* Make new item with ellipsized text */ - gchar* list_item; - if (prefs.show_indexes) - { - list_item = g_strdup_printf("%d. %s", (element_number+1), string->str); - } else { - list_item = g_strdup(string->str); - } - menu_item = gtk_menu_item_new_with_label(list_item); - g_signal_connect((GObject*)menu_item, "activate", (GCallback)item_selected, GINT_TO_POINTER(element_number)); - /* Modify menu item label properties */ - item_label = gtk_bin_get_child((GtkBin*)menu_item); - gtk_label_set_single_line_mode((GtkLabel*)item_label, prefs.single_line); - - /* Check if item is also clipboard text and make bold */ - if ((clipboard_temp) && (g_strcmp0((gchar*)element->data, clipboard_temp) == 0)) - { - gchar* bold_text = g_markup_printf_escaped("%s", list_item); - gtk_label_set_markup((GtkLabel*)item_label, bold_text); - g_free(bold_text); - } - else if ((primary_temp) && (g_strcmp0((gchar*)element->data, primary_temp) == 0)) - { - gchar* italic_text = g_markup_printf_escaped("%s", list_item); - gtk_label_set_markup((GtkLabel*)item_label, italic_text); - g_free(italic_text); - } - g_free(list_item); - /* Append item */ - gtk_menu_shell_append((GtkMenuShell*)menu, menu_item); - /* Prepare for next item */ - g_string_free(string, TRUE); - if (prefs.reverse_history) - element_number--; - else - element_number++; - } - /* Cleanup */ - g_free(primary_temp); - g_free(clipboard_temp); - /* Return history to normal if reversed */ - if (prefs.reverse_history) - history = g_slist_reverse(history); - } - else - { - /* Nothing in history so adding empty */ - menu_item = gtk_menu_item_new_with_label(_("Empty")); - gtk_widget_set_sensitive(menu_item, FALSE); - gtk_menu_shell_append((GtkMenuShell*)menu, menu_item); - } - /* Popup the menu... */ - gtk_widget_show_all(menu); - gtk_menu_popup((GtkMenu*)menu, NULL, NULL, NULL, NULL, 1, gtk_get_current_event_time()); - /* Return FALSE so the g_timeout_add() function is called only once */ - return FALSE; -} - /* Generates the small history menu */ -static gboolean show_history_menu_small(gpointer data) +static gboolean show_history_menu(gpointer data) { /* Declare some variables */ GtkWidget *menu, *menu_item, *menu_image, *item_label; @@ -578,7 +490,7 @@ static gboolean show_history_menu_small(gpointer data) element_number = g_slist_length(history) - 1; } /* Go through each element and adding each */ - for (element = history; (element != NULL) && (element_number_small < prefs.history_small); element = element->next) + for (element = history; (element != NULL) && (element_number_small < prefs.items_menu); element = element->next) { GString* string = g_string_new((gchar*)element->data); /* Ellipsize text */ @@ -638,31 +550,10 @@ static gboolean show_history_menu_small(gpointer data) gtk_widget_set_sensitive(menu_item, FALSE); gtk_menu_shell_append((GtkMenuShell*)menu, menu_item); } - /* -------------------- */ - /* Show full history button (if enabled) */ - if (!prefs.full_hist_button) - { - gtk_menu_shell_append((GtkMenuShell*)menu, gtk_separator_menu_item_new()); - menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Show full history")); - menu_image = gtk_image_new_from_stock(GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image((GtkImageMenuItem*)menu_item, menu_image); - g_signal_connect((GObject*)menu_item, "activate", (GCallback)show_history_menu_full, NULL); - gtk_menu_shell_append((GtkMenuShell*)menu, menu_item); - } /* Popup the menu... */ gtk_widget_show_all(menu); gtk_menu_popup((GtkMenu*)menu, NULL, NULL, NULL, NULL, 1, gtk_get_current_event_time()); - /* Return FALSE so the g_timeout_add() function is called only once */ - return FALSE; -} - -/* Called when status icon is left-clicked or the history menu hotkey is pressed */ -static gboolean show_history_menu() -{ - if (prefs.small_history) - g_timeout_add(POPUP_DELAY, show_history_menu_small, NULL); - else - g_timeout_add(POPUP_DELAY, show_history_menu_full, NULL); + gtk_menu_shell_select_first((GtkMenuShell*)menu, TRUE); /* Return FALSE so the g_timeout_add() function is called only once */ return FALSE; } @@ -692,7 +583,7 @@ void create_app_indicator(gint create) element_number = g_slist_length(history) - 1; } /* Go through each element and adding each */ - for (element = history; (element != NULL) && (element_number_small < prefs.history_small); element = element->next) + for (element = history; (element != NULL) && (element_number_small < prefs.items_menu); element = element->next) { GString* string = g_string_new((gchar*)element->data); /* Ellipsize text */ @@ -760,12 +651,6 @@ void create_app_indicator(gint create) menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL); g_signal_connect((GObject*)menu_item, "activate", (GCallback)show_about_dialog, NULL); gtk_menu_shell_append((GtkMenuShell*)indicator_menu, menu_item); - /* Full history button (if enabled) */ - menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Show full history")); - menu_image = gtk_image_new_from_stock(GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image((GtkImageMenuItem*)menu_item, menu_image); - g_signal_connect((GObject*)menu_item, "activate", (GCallback)show_history_menu_full, NULL); - gtk_menu_shell_append((GtkMenuShell*)indicator_menu, menu_item); /* Manage history */ menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Manage history")); menu_image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); @@ -826,7 +711,7 @@ static gboolean show_clipit_menu() element_number = g_slist_length(history) - 1; } /* Go through each element and adding each */ - for (element = history; (element != NULL) && (element_number_small < prefs.history_small); element = element->next) + for (element = history; (element != NULL) && (element_number_small < prefs.items_menu); element = element->next) { GString* string = g_string_new((gchar*)element->data); /* Ellipsize text */ @@ -894,15 +779,6 @@ static gboolean show_clipit_menu() menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL); g_signal_connect((GObject*)menu_item, "activate", (GCallback)show_about_dialog, NULL); gtk_menu_shell_append((GtkMenuShell*)statusicon_menu, menu_item); - /* Full history button (if enabled) */ - if (prefs.full_hist_button && prefs.small_history) - { - menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Show full history")); - menu_image = gtk_image_new_from_stock(GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image((GtkImageMenuItem*)menu_item, menu_image); - g_signal_connect((GObject*)menu_item, "activate", (GCallback)show_history_menu_full, NULL); - gtk_menu_shell_append((GtkMenuShell*)statusicon_menu, menu_item); - } /* Manage history */ menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Manage history")); menu_image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU); @@ -921,6 +797,7 @@ static gboolean show_clipit_menu() gtk_widget_show_all(statusicon_menu); gtk_widget_set_visible(statusicon_menu, TRUE); gtk_menu_popup((GtkMenu*)statusicon_menu, NULL, NULL, gtk_status_icon_position_menu, status_icon, 1, gtk_get_current_event_time()); + gtk_menu_shell_select_first((GtkMenuShell*)statusicon_menu, TRUE); status_menu_lock = FALSE; } diff --git a/src/main.h b/src/main.h index 53b3bc4..276fa13 100644 --- a/src/main.h +++ b/src/main.h @@ -41,9 +41,7 @@ typedef struct gboolean save_history; /* Save history */ gint history_limit; /* Items in history */ - gboolean small_history; /* Use small history */ - gint history_small; /* Items in small history */ - gboolean full_hist_button; /* Fix clipboard */ + gint items_menu; /* Items in small history */ gboolean hyperlinks_only; /* Hyperlinks only */ gboolean confirm_clear; /* Confirm clear */ diff --git a/src/preferences.c b/src/preferences.c index abdf584..8f6fc8e 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -34,9 +34,8 @@ GtkWidget *copy_check, *synchronize_check, *show_indexes_check, *save_uris_check, - *full_hist_check, *history_spin, - *history_small, + *items_menu, *charlength_spin, *ellipsize_combo, *history_key_entry, @@ -44,7 +43,6 @@ GtkWidget *copy_check, *menu_key_entry, *search_key_entry, *save_check, - *small_check, *confirm_check, *reverse_check, *linemode_check, @@ -80,11 +78,9 @@ static void apply_preferences() prefs.save_uris = gtk_toggle_button_get_active((GtkToggleButton*)save_uris_check); prefs.save_history = gtk_toggle_button_get_active((GtkToggleButton*)save_check); prefs.history_limit = gtk_spin_button_get_value_as_int((GtkSpinButton*)history_spin); - prefs.small_history = gtk_toggle_button_get_active((GtkToggleButton*)small_check); - prefs.history_small = gtk_spin_button_get_value_as_int((GtkSpinButton*)history_small); + prefs.items_menu = gtk_spin_button_get_value_as_int((GtkSpinButton*)items_menu); prefs.hyperlinks_only = gtk_toggle_button_get_active((GtkToggleButton*)hyperlinks_check); prefs.confirm_clear = gtk_toggle_button_get_active((GtkToggleButton*)confirm_check); - prefs.full_hist_button = gtk_toggle_button_get_active((GtkToggleButton*)full_hist_check); prefs.single_line = gtk_toggle_button_get_active((GtkToggleButton*)linemode_check); prefs.reverse_history = gtk_toggle_button_get_active((GtkToggleButton*)reverse_check); prefs.item_length = gtk_spin_button_get_value_as_int((GtkSpinButton*)charlength_spin); @@ -116,11 +112,9 @@ static void save_preferences() 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); g_key_file_set_integer(rc_key, "rc", "history_limit", prefs.history_limit); - g_key_file_set_boolean(rc_key, "rc", "small_history", prefs.small_history); - g_key_file_set_integer(rc_key, "rc", "history_small", prefs.history_small); + g_key_file_set_integer(rc_key, "rc", "items_menu", prefs.items_menu); g_key_file_set_boolean(rc_key, "rc", "hyperlinks_only", prefs.hyperlinks_only); g_key_file_set_boolean(rc_key, "rc", "confirm_clear", prefs.confirm_clear); - g_key_file_set_boolean(rc_key, "rc", "full_hist_button", prefs.full_hist_button); g_key_file_set_boolean(rc_key, "rc", "single_line", prefs.single_line); g_key_file_set_boolean(rc_key, "rc", "reverse_history", prefs.reverse_history); g_key_file_set_integer(rc_key, "rc", "item_length", prefs.item_length); @@ -221,11 +215,9 @@ void read_preferences() 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); prefs.history_limit = g_key_file_get_integer(rc_key, "rc", "history_limit", NULL); - prefs.small_history = g_key_file_get_boolean(rc_key, "rc", "small_history", NULL); - prefs.history_small = g_key_file_get_integer(rc_key, "rc", "history_small", NULL); + prefs.items_menu = g_key_file_get_integer(rc_key, "rc", "items_menu", NULL); prefs.hyperlinks_only = g_key_file_get_boolean(rc_key, "rc", "hyperlinks_only", NULL); prefs.confirm_clear = g_key_file_get_boolean(rc_key, "rc", "confirm_clear", NULL); - prefs.full_hist_button = g_key_file_get_boolean(rc_key, "rc", "full_hist_button", NULL); prefs.single_line = g_key_file_get_boolean(rc_key, "rc", "single_line", NULL); prefs.reverse_history = g_key_file_get_boolean(rc_key, "rc", "reverse_history", NULL); prefs.item_length = g_key_file_get_integer(rc_key, "rc", "item_length", NULL); @@ -238,8 +230,8 @@ void read_preferences() /* Check for errors and set default values if any */ if ((!prefs.history_limit) || (prefs.history_limit > 1000) || (prefs.history_limit < 0)) prefs.history_limit = DEF_HISTORY_LIMIT; - if ((!prefs.history_small) || (prefs.history_small > 100) || (prefs.history_small < 0)) - prefs.history_limit = DEF_HISTORY_SMALL; + if ((!prefs.items_menu) || (prefs.items_menu > 1000) || (prefs.items_menu < 0)) + prefs.items_menu = DEF_ITEMS_MENU; if ((!prefs.item_length) || (prefs.item_length > 75) || (prefs.item_length < 0)) prefs.item_length = DEF_ITEM_LENGTH; if ((!prefs.ellipsize) || (prefs.ellipsize > 3) || (prefs.ellipsize < 0)) @@ -714,21 +706,15 @@ void show_preferences(gint tab) history_spin = gtk_spin_button_new((GtkAdjustment*)adjustment, 0.0, 0); gtk_spin_button_set_update_policy((GtkSpinButton*)history_spin, GTK_UPDATE_IF_VALID); gtk_box_pack_start((GtkBox*)hbox, history_spin, FALSE, FALSE, 0); - small_check = gtk_check_button_new_with_mnemonic(_("_Use small history")); - gtk_widget_set_tooltip_text(small_check, _("Use a small history window to prevent scrolling")); - gtk_box_pack_start((GtkBox*)vbox, small_check, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start((GtkBox*)vbox, hbox, FALSE, FALSE, 0); - label = gtk_label_new(_("Small history size:")); + label = gtk_label_new(_("Items in menu:")); gtk_misc_set_alignment((GtkMisc*)label, 0.0, 0.50); gtk_box_pack_start((GtkBox*)hbox, label, FALSE, FALSE, 0); adjustment_small = gtk_adjustment_new(25, 5, 100, 1, 10, 0); - history_small = gtk_spin_button_new((GtkAdjustment*)adjustment_small, 0.0, 0); - gtk_spin_button_set_update_policy((GtkSpinButton*)history_small, GTK_UPDATE_IF_VALID); - gtk_box_pack_start((GtkBox*)hbox, history_small, FALSE, FALSE, 0); - full_hist_check = gtk_check_button_new_with_mnemonic(_("_Full history button in panel menu")); - gtk_widget_set_tooltip_text(full_hist_check, _("Shows the \"full history\" button only in the panel menu, to keep the pop-up menu clean")); - gtk_box_pack_start((GtkBox*)vbox, full_hist_check, FALSE, FALSE, 0); + items_menu = gtk_spin_button_new((GtkAdjustment*)adjustment_small, 0.0, 0); + gtk_spin_button_set_update_policy((GtkSpinButton*)items_menu, GTK_UPDATE_IF_VALID); + gtk_box_pack_start((GtkBox*)hbox, items_menu, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_history, frame, FALSE, FALSE, 0); /* Build the items frame */ @@ -975,11 +961,9 @@ void show_preferences(gint tab) gtk_toggle_button_set_active((GtkToggleButton*)save_uris_check, prefs.save_uris); gtk_toggle_button_set_active((GtkToggleButton*)save_check, prefs.save_history); gtk_spin_button_set_value((GtkSpinButton*)history_spin, (gdouble)prefs.history_limit); - gtk_toggle_button_set_active((GtkToggleButton*)small_check, prefs.small_history); - gtk_spin_button_set_value((GtkSpinButton*)history_small, (gdouble)prefs.history_small); + gtk_spin_button_set_value((GtkSpinButton*)items_menu, (gdouble)prefs.items_menu); gtk_toggle_button_set_active((GtkToggleButton*)hyperlinks_check, prefs.hyperlinks_only); gtk_toggle_button_set_active((GtkToggleButton*)confirm_check, prefs.confirm_clear); - gtk_toggle_button_set_active((GtkToggleButton*)full_hist_check, prefs.full_hist_button); gtk_toggle_button_set_active((GtkToggleButton*)linemode_check, prefs.single_line); gtk_toggle_button_set_active((GtkToggleButton*)reverse_check, prefs.reverse_history); gtk_spin_button_set_value((GtkSpinButton*)charlength_spin, (gdouble)prefs.item_length); diff --git a/src/preferences.h b/src/preferences.h index 2c2c611..0ac55e8 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -36,11 +36,9 @@ G_BEGIN_DECLS #define DEF_SAVE_URIS TRUE #define DEF_SAVE_HISTORY TRUE #define DEF_HISTORY_LIMIT 50 -#define DEF_SMALL_HISTORY TRUE -#define DEF_HISTORY_SMALL 20 +#define DEF_ITEMS_MENU 20 #define DEF_HYPERLINKS_ONLY FALSE #define DEF_CONFIRM_CLEAR FALSE -#define DEF_FULL_HIST_BUTTON FALSE #define DEF_SINGLE_LINE TRUE #define DEF_REVERSE_HISTORY FALSE #define DEF_ITEM_LENGTH 50