[file-roller] removed all the deprecated functions
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] removed all the deprecated functions
- Date: Sat, 21 Dec 2013 16:01:56 +0000 (UTC)
commit 58f52e2bc88a79bb4be6691c12b8c4f71decf78e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Dec 21 16:47:15 2013 +0100
removed all the deprecated functions
po/POTFILES.in | 16 +-
src/Makefile.am | 15 +-
src/actions.c | 484 --------------
src/actions.h | 73 ---
src/dlg-add.c | 32 +-
src/dlg-extract.c | 13 +-
src/dlg-package-installer.c | 4 +-
src/eggtreemultidnd.c | 12 +-
src/file-roller.gresource.xml | 1 +
src/{app-menu.c => fr-application-menu.c} | 122 ++--
src/{app-menu.h => fr-application-menu.h} | 0
src/fr-application.c | 2 +-
src/fr-init.c | 2 -
src/fr-new-archive-dialog.c | 13 +-
src/fr-stock.c | 80 ---
src/fr-stock.h | 32 -
src/fr-window-actions-callbacks.c | 325 ++++++++++-
src/fr-window-actions-callbacks.h | 27 +-
src/fr-window-actions-entries.h | 36 +-
src/fr-window.c | 266 +++++----
src/gth-menu-button.c | 398 ------------
src/gth-menu-button.h | 77 ---
src/gth-toggle-menu-action.c | 240 -------
src/gth-toggle-menu-action.h | 64 --
src/gth-toggle-menu-tool-button.c | 986 -----------------------------
src/gth-toggle-menu-tool-button.h | 85 ---
src/gtk-utils.c | 54 +--
src/gtk-utils.h | 17 +-
src/ui.h | 215 -------
src/ui/Makefile.am | 1 +
src/ui/app-menu.ui | 4 +
src/ui/gears-menu.ui | 1 +
src/ui/menus.ui | 116 ++++
33 files changed, 775 insertions(+), 3038 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4535521..f49066b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,10 +12,6 @@ data/org.gnome.FileRoller.gschema.xml.in
nautilus/fileroller-module.c
nautilus/nautilus-fileroller.c
nautilus/nautilus-fileroller.h
-src/actions.c
-src/actions.h
-src/app-menu.c
-src/app-menu.h
src/commands/rpm2cpio.c
src/dlg-add.c
src/dlg-add.h
@@ -46,6 +42,8 @@ src/file-utils.c
src/file-utils.h
src/fr-application.c
src/fr-application.h
+src/fr-application-menu.c
+src/fr-application-menu.h
src/fr-archive.c
src/fr-archive.h
src/fr-archive-libarchive.c
@@ -102,8 +100,6 @@ src/fr-new-archive-dialog.c
src/fr-new-archive-dialog.h
src/fr-process.c
src/fr-process.h
-src/fr-stock.c
-src/fr-stock.h
src/fr-window-actions-callbacks.c
src/fr-window-actions-callbacks.h
src/fr-window-actions-entries.h
@@ -115,12 +111,6 @@ src/glib-utils.c
src/glib-utils.h
src/gth-icon-cache.c
src/gth-icon-cache.h
-src/gth-menu-button.c
-src/gth-menu-button.h
-src/gth-toggle-menu-action.c
-src/gth-toggle-menu-action.h
-src/gth-toggle-menu-tool-button.c
-src/gth-toggle-menu-tool-button.h
src/gtk-utils.c
src/gtk-utils.h
src/java-utils.c
@@ -146,8 +136,8 @@ src/typedefs.h
[type: gettext/glade]src/ui/extract-dialog-options.ui
[type: gettext/glade]src/ui/file-selector.ui
[type: gettext/glade]src/ui/gears-menu.ui
-src/ui.h
[type: gettext/glade]src/ui/menus-toolbars.ui
+[type: gettext/glade]src/ui/menus.ui
[type: gettext/glade]src/ui/message-dialog.ui
[type: gettext/glade]src/ui/new-archive-dialog.ui
[type: gettext/glade]src/ui/password.ui
diff --git a/src/Makefile.am b/src/Makefile.am
index c289eab..b765976 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,10 +55,6 @@ BUILT_SOURCES = \
$(NULL)
COMMON_SOURCES = \
- actions.h \
- actions.c \
- app-menu.c \
- app-menu.h \
dlg-add.c \
dlg-add.h \
dlg-ask-password.c \
@@ -88,6 +84,8 @@ COMMON_SOURCES = \
file-utils.h \
fr-application.c \
fr-application.h \
+ fr-application-menu.c \
+ fr-application-menu.h \
fr-archive.c \
fr-archive.h \
fr-command.c \
@@ -138,8 +136,6 @@ COMMON_SOURCES = \
fr-list-model.h \
fr-new-archive-dialog.c \
fr-new-archive-dialog.h \
- fr-stock.c \
- fr-stock.h \
fr-process.c \
fr-process.h \
fr-window.c \
@@ -153,12 +149,6 @@ COMMON_SOURCES = \
glib-utils.h \
gth-icon-cache.c \
gth-icon-cache.h \
- gth-menu-button.c \
- gth-menu-button.h \
- gth-toggle-menu-action.c \
- gth-toggle-menu-action.h \
- gth-toggle-menu-tool-button.c \
- gth-toggle-menu-tool-button.h \
gtk-utils.c \
gtk-utils.h \
java-utils.c \
@@ -170,7 +160,6 @@ COMMON_SOURCES = \
rar-utils.c \
rar-utils.h \
typedefs.h \
- ui.h \
$(MKDTEMP_FILES) \
$(BUILT_SOURCES)
diff --git a/src/dlg-add.c b/src/dlg-add.c
index dbc7e0a..7faeb0b 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -28,10 +28,8 @@
#include "dlg-add.h"
#include "file-utils.h"
#include "fr-file-selector-dialog.h"
-#include "fr-stock.h"
#include "fr-window.h"
#include "glib-utils.h"
-#include "gth-menu-button.h"
#include "gtk-utils.h"
#include "preferences.h"
@@ -189,13 +187,12 @@ dlg_add (FrWindow *window)
/* options menu button */
- options_button = gth_menu_button_new ();
- gth_menu_button_set_label (GTH_MENU_BUTTON (options_button), _("_Options"));
- gth_menu_button_set_use_underline (GTH_MENU_BUTTON (options_button), TRUE);
+ options_button = gtk_menu_button_new ();
+ gtk_button_set_label (GTK_BUTTON (options_button), _("_Options"));
+ gtk_button_set_use_underline (GTK_BUTTON (options_button), TRUE);
gtk_widget_show (options_button);
options_menu = gtk_menu_new ();
- gth_menu_button_set_menu (GTH_MENU_BUTTON (options_button), options_menu);
/* load options */
@@ -218,6 +215,8 @@ dlg_add (FrWindow *window)
g_signal_connect (menu_item, "activate", G_CALLBACK (clear_options_activate_cb), data);
gtk_menu_shell_append (GTK_MENU_SHELL (options_menu), menu_item);
+ gtk_menu_button_set_popup (GTK_MENU_BUTTON (options_button), options_menu);
+
/* add the buttons */
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (data->dialog))),
@@ -226,10 +225,10 @@ dlg_add (FrWindow *window)
FALSE,
0);
gtk_dialog_add_button (GTK_DIALOG (data->dialog),
- GTK_STOCK_CANCEL,
+ _GTK_LABEL_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (data->dialog),
- FR_STOCK_ADD_FOLDER,
+ _GTK_LABEL_ADD,
GTK_RESPONSE_OK);
/* set data */
@@ -821,15 +820,14 @@ save_options_activate_cb (GtkMenuItem *menu_item,
options_dir = _g_file_new_user_config_subdir (ADD_FOLDER_OPTIONS_DIR, TRUE);
_g_file_make_directory_tree (options_dir, 0700, NULL);
- opt_filename = _gtk_request_dialog_run (
- GTK_WINDOW (data->dialog),
- GTK_DIALOG_MODAL,
- _("Save Options"),
- _("_Options Name:"),
- (data->last_options != NULL) ? data->last_options : "",
- 1024,
- GTK_STOCK_CANCEL,
- GTK_STOCK_SAVE);
+ opt_filename = _gtk_request_dialog_run (GTK_WINDOW (data->dialog),
+ GTK_DIALOG_MODAL,
+ _("Save Options"),
+ _("_Options Name:"),
+ (data->last_options != NULL) ? data->last_options : "",
+ 1024,
+ _GTK_LABEL_CANCEL,
+ _GTK_LABEL_SAVE);
if (opt_filename == NULL)
return;
diff --git a/src/dlg-extract.c b/src/dlg-extract.c
index 0a33b02..ca3c813 100644
--- a/src/dlg-extract.c
+++ b/src/dlg-extract.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <unistd.h>
#include "file-utils.h"
-#include "fr-stock.h"
#include "fr-init.h"
#include "glib-utils.h"
#include "gtk-utils.h"
@@ -98,10 +97,10 @@ extract_cb (GtkWidget *w,
d = _gtk_message_dialog_new (GTK_WINDOW (data->dialog),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
msg,
NULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
_("Create _Folder"), GTK_RESPONSE_YES,
NULL);
@@ -138,10 +137,10 @@ extract_cb (GtkWidget *w,
d = _gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_DIALOG_WARNING,
+ _GTK_ICON_NAME_DIALOG_WARNING,
_("Extraction not performed"),
NULL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _GTK_LABEL_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
gtk_dialog_run (GTK_DIALOG (d));
@@ -283,8 +282,8 @@ dlg_extract__common (FrWindow *window,
data->dialog = gtk_file_chooser_dialog_new (_("Extract"),
GTK_WINDOW (data->window),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- FR_STOCK_EXTRACT, GTK_RESPONSE_OK,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_EXTRACT, GTK_RESPONSE_OK,
NULL);
gtk_window_set_default_size (GTK_WINDOW (data->dialog), 530, 510);
diff --git a/src/dlg-package-installer.c b/src/dlg-package-installer.c
index 6fa8b4c..70f1e94 100644
--- a/src/dlg-package-installer.c
+++ b/src/dlg-package-installer.c
@@ -314,10 +314,10 @@ file_buffer_ready_cb (GObject *source_object,
g_content_type_get_description (mime_type));
dialog = _gtk_message_dialog_new (GTK_WINDOW (idata->window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_ERROR,
+ _GTK_ICON_NAME_DIALOG_ERROR,
_("Could not open this file type"),
secondary_text,
- GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_NO,
_("_Search Command"), GTK_RESPONSE_YES,
NULL);
g_signal_connect (dialog, "response", G_CALLBACK (confirm_search_dialog_response_cb), idata);
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c
index 1bfe39a..15ebc4b 100644
--- a/src/eggtreemultidnd.c
+++ b/src/eggtreemultidnd.c
@@ -303,11 +303,13 @@ egg_tree_multi_drag_motion_event (GtkWidget *widget,
int cell_y;
target_list = gtk_target_list_new (target_table, G_N_ELEMENTS (target_table));
- context = gtk_drag_begin (widget,
- target_list,
- GDK_ACTION_COPY,
- priv_data->pressed_button,
- (GdkEvent*)event);
+ context = gtk_drag_begin_with_coordinates (widget,
+ target_list,
+ GDK_ACTION_COPY,
+ priv_data->pressed_button,
+ (GdkEvent*) event,
+ event->x,
+ event->y);
set_context_data (context, path_list);
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
diff --git a/src/file-roller.gresource.xml b/src/file-roller.gresource.xml
index 0c92547..4c5a3b3 100644
--- a/src/file-roller.gresource.xml
+++ b/src/file-roller.gresource.xml
@@ -11,6 +11,7 @@
<file compressed="true">ui/extract-dialog-options.ui</file>
<file compressed="true">ui/file-selector.ui</file>
<file compressed="true">ui/gears-menu.ui</file>
+ <file compressed="true">ui/menus.ui</file>
<file compressed="true">ui/menus-toolbars.ui</file>
<file compressed="true">ui/message-dialog.ui</file>
<file compressed="true">ui/new-archive-dialog.ui</file>
diff --git a/src/app-menu.c b/src/fr-application-menu.c
similarity index 71%
rename from src/app-menu.c
rename to src/fr-application-menu.c
index 1d0a662..2b773cc 100644
--- a/src/app-menu.c
+++ b/src/fr-application-menu.c
@@ -21,10 +21,10 @@
#include <config.h>
-#include "actions.h"
-#include "app-menu.h"
#include "fr-application.h"
+#include "fr-application-menu.h"
#include "fr-enum-types.h"
+#include "fr-window-actions-callbacks.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
@@ -48,51 +48,35 @@ update_app_menu_sensitivity (GApplication *application)
static void
-toggle_action_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
+fr_application_activate_new (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GVariant *state;
+ GtkWidget *window;
- state = g_action_get_state (G_ACTION (action));
- g_action_change_state (G_ACTION (action), g_variant_new_boolean (! g_variant_get_boolean (state)));
-
- g_variant_unref (state);
+ window = _gtk_application_get_current_window (G_APPLICATION (user_data));
+ if (window != NULL)
+ fr_window_activate_new (action, parameter, window);
}
static void
-activate_new (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_open (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GApplication *application = user_data;
- GList *windows;
+ GtkWidget *window;
- windows = gtk_application_get_windows (GTK_APPLICATION (application));
- if (windows != NULL)
- activate_action_new (NULL, windows->data);
+ window = _gtk_application_get_current_window (G_APPLICATION (user_data));
+ if (window != NULL)
+ fr_window_activate_open (action, parameter, window);
}
static void
-activate_open (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GApplication *application = user_data;
- GList *windows;
-
- windows = gtk_application_get_windows (GTK_APPLICATION (application));
- if (windows != NULL)
- activate_action_open (NULL, windows->data);
-}
-
-
-static void
-activate_view_sidebar (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_view_sidebar (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
FrApplication *application = user_data;
GSettings *settings;
@@ -103,9 +87,9 @@ activate_view_sidebar (GSimpleAction *action,
static void
-activate_list_mode (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_list_mode (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
FrApplication *application = user_data;
GSettings *settings;
@@ -122,50 +106,56 @@ activate_list_mode (GSimpleAction *action,
static void
-activate_help (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GApplication *application = user_data;
- GList *windows;
+ GtkWidget *window;
- windows = gtk_application_get_windows (GTK_APPLICATION (application));
- if (windows != NULL)
- activate_action_manual (NULL, windows->data);
+ window = _gtk_application_get_current_window (G_APPLICATION (user_data));
+ _gtk_show_help_dialog (GTK_WINDOW (window) , NULL);
}
static void
-activate_about (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_about (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GApplication *application = user_data;
- GList *windows;
-
- windows = gtk_application_get_windows (GTK_APPLICATION (application));
- if (windows != NULL)
- activate_action_about (NULL, windows->data);
+ const char *authors[] = { "Paolo Bacchilega <paolo bacchilega libero it>", NULL };
+ const char *documenters [] = { "Alexander Kirillov", "Breda McColgan", NULL };
+
+ gtk_show_about_dialog (GTK_WINDOW (_gtk_application_get_current_window (G_APPLICATION (user_data))),
+ "version", VERSION,
+ "copyright", _("Copyright \xc2\xa9 2001–2014 Free Software Foundation, Inc."),
+ "comments", _("An archive manager for GNOME."),
+ "authors", authors,
+ "documenters", documenters,
+ "translator-credits", _("translator-credits"),
+ "logo-icon-name", "file-roller",
+ "license-type", GTK_LICENSE_GPL_2_0,
+ "wrap-license", TRUE,
+ NULL);
}
static void
-activate_quit (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+fr_application_activate_quit (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- activate_action_quit (NULL, NULL);
+ g_application_quit (G_APPLICATION (user_data));
}
static const GActionEntry app_menu_entries[] = {
- { "new", activate_new },
- { "open", activate_open },
- { PREF_UI_VIEW_SIDEBAR, toggle_action_activated, NULL, "true", activate_view_sidebar },
- { PREF_LISTING_LIST_MODE, activate_list_mode, "s", "'as-dir'", NULL },
- { "help", activate_help },
- { "about", activate_about },
- { "quit", activate_quit }
+ { "new", fr_application_activate_new },
+ { "open", fr_application_activate_open },
+ { PREF_UI_VIEW_SIDEBAR, toggle_action_activated, NULL, "true", fr_application_activate_view_sidebar },
+ { PREF_LISTING_LIST_MODE, fr_application_activate_list_mode, "s", "'as-dir'", NULL },
+ { "help", fr_application_activate_help },
+ { "about", fr_application_activate_about },
+ { "quit", fr_application_activate_quit }
};
diff --git a/src/app-menu.h b/src/fr-application-menu.h
similarity index 100%
rename from src/app-menu.h
rename to src/fr-application-menu.h
diff --git a/src/fr-application.c b/src/fr-application.c
index 5ea4652..0109a3a 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -30,13 +30,13 @@
#ifdef ENABLE_NOTIFICATION
# include <libnotify/notify.h>
#endif
-#include "app-menu.h"
#ifdef USE_SMCLIENT
# include "eggsmclient.h"
#endif
#include "eggdesktopfile.h"
#include "file-utils.h"
#include "fr-application.h"
+#include "fr-application-menu.h"
#include "fr-init.h"
#include "glib-utils.h"
#include "gtk-utils.h"
diff --git a/src/fr-init.c b/src/fr-init.c
index 2c3ad75..db9aba8 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -52,7 +52,6 @@
#include "fr-command-7z.h"
#include "fr-init.h"
#include "fr-process.h"
-#include "fr-stock.h"
#include "fr-window.h"
#include "typedefs.h"
#include "preferences.h"
@@ -630,7 +629,6 @@ initialize_data (void)
migrate_options_directory ();
register_archives ();
compute_supported_archive_types ();
- fr_stock_init ();
}
diff --git a/src/fr-new-archive-dialog.c b/src/fr-new-archive-dialog.c
index 68590e6..d9c038b 100644
--- a/src/fr-new-archive-dialog.c
+++ b/src/fr-new-archive-dialog.c
@@ -27,7 +27,6 @@
#include "file-utils.h"
#include "fr-init.h"
#include "fr-new-archive-dialog.h"
-#include "fr-stock.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
@@ -222,19 +221,19 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET
("content"));
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL);
switch (action) {
case FR_NEW_ARCHIVE_ACTION_NEW_MANY_FILES:
self->priv->supported_types = create_type;
- gtk_dialog_add_button (GTK_DIALOG (self), FR_STOCK_CREATE_ARCHIVE, GTK_RESPONSE_OK);
+ gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CREATE_ARCHIVE, GTK_RESPONSE_OK);
break;
case FR_NEW_ARCHIVE_ACTION_NEW_SINGLE_FILE:
self->priv->supported_types = single_file_save_type;
- gtk_dialog_add_button (GTK_DIALOG (self), FR_STOCK_CREATE_ARCHIVE, GTK_RESPONSE_OK);
+ gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_CREATE_ARCHIVE, GTK_RESPONSE_OK);
break;
case FR_NEW_ARCHIVE_ACTION_SAVE_AS:
self->priv->supported_types = save_type;
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
+ gtk_dialog_add_button (GTK_DIALOG (self), _GTK_LABEL_SAVE, GTK_RESPONSE_OK);
break;
}
gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
@@ -467,10 +466,10 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
secondary_message = g_strdup_printf (_("The file already exists in \"%s\". Replacing it will
overwrite its contents."), g_file_info_get_display_name (parent_info));
dialog = _gtk_message_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
message,
secondary_message,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
_("_Replace"), GTK_RESPONSE_OK,
NULL);
overwrite = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK;
diff --git a/src/fr-window-actions-callbacks.c b/src/fr-window-actions-callbacks.c
index 7ac1e2a..281f62c 100644
--- a/src/fr-window-actions-callbacks.c
+++ b/src/fr-window-actions-callbacks.c
@@ -22,11 +22,15 @@
#include <config.h>
#include "dlg-add.h"
+#include "dlg-delete.h"
#include "dlg-extract.h"
+#include "dlg-open-with.h"
#include "dlg-password.h"
#include "dlg-prop.h"
+#include "fr-init.h"
#include "fr-window.h"
#include "fr-window-actions-callbacks.h"
+#include "gtk-utils.h"
void
@@ -43,7 +47,7 @@ toggle_action_activated (GSimpleAction *action,
}
-static GtkWidget *
+GtkWidget *
_gtk_application_get_current_window (GApplication *application)
{
GList *windows;
@@ -75,14 +79,38 @@ fr_window_activate_close (GSimpleAction *action,
void
-fr_window_activate_edit_find (GSimpleAction *action,
- GVariant *state,
+fr_window_activate_delete (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ dlg_delete (NULL, FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_deselect_all (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_unselect_all (FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_edit_copy (GSimpleAction *action,
+ GVariant *parameter,
gpointer user_data)
{
- FrWindow *window = FR_WINDOW (user_data);
+ fr_window_copy_selection (FR_WINDOW (user_data), FALSE);
+}
- g_simple_action_set_state (action, state);
- fr_window_find (window, g_variant_get_boolean (state));
+
+void
+fr_window_activate_edit_cut (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_cut_selection (FR_WINDOW (user_data), FALSE);
}
@@ -96,6 +124,15 @@ fr_window_activate_edit_password (GSimpleAction *action,
void
+fr_window_activate_edit_paste (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_paste_selection (FR_WINDOW (user_data), FALSE);
+}
+
+
+void
fr_window_activate_extract_files (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -105,6 +142,18 @@ fr_window_activate_extract_files (GSimpleAction *action,
void
+fr_window_activate_find (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ FrWindow *window = FR_WINDOW (user_data);
+
+ g_simple_action_set_state (action, state);
+ fr_window_find (window, g_variant_get_boolean (state));
+}
+
+
+void
fr_window_activate_go_back (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -132,6 +181,158 @@ fr_window_activate_go_home (GSimpleAction *action,
void
+fr_window_activate_open_folder (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_current_folder_activated (FR_WINDOW (user_data), FALSE);
+}
+
+
+void
+fr_window_activate_open_selection (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+// TODO
+}
+
+
+void
+fr_window_activate_open_with (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ open_with_cb (NULL, FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_reload (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_archive_reload (FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_rename (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_rename_selection (FR_WINDOW (user_data), FALSE);
+}
+
+
+void
+fr_window_activate_new (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_action_new_archive (FR_WINDOW (user_data));
+}
+
+
+/* -- fr_window_activate_open -- */
+
+
+static void
+window_archive_loaded_cb (FrWindow *window,
+ gboolean success,
+ GtkWidget *file_sel)
+{
+ if (success) {
+ g_signal_handlers_disconnect_by_data (window, file_sel);
+ gtk_widget_destroy (file_sel);
+ }
+ else {
+ FrWindow *original_window = g_object_get_data (G_OBJECT (file_sel), "fr_window");
+ if (window != original_window)
+ fr_window_destroy_with_error_dialog (window);
+ }
+}
+
+
+static void
+open_file_response_cb (GtkWidget *w,
+ int response,
+ GtkWidget *file_sel)
+{
+ FrWindow *window = NULL;
+ GFile *file;
+
+ if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
+ gtk_widget_destroy (file_sel);
+ return;
+ }
+
+ window = g_object_get_data (G_OBJECT (file_sel), "fr_window");
+ file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_sel));
+
+ if ((window == NULL) || (file == NULL))
+ return;
+
+ if (fr_window_archive_is_present (window))
+ window = (FrWindow *) fr_window_new ();
+ g_signal_connect (G_OBJECT (window),
+ "archive_loaded",
+ G_CALLBACK (window_archive_loaded_cb),
+ file_sel);
+ fr_window_archive_open (window, file, GTK_WINDOW (file_sel));
+
+ g_object_unref (file);
+}
+
+
+void
+fr_window_activate_open (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ FrWindow *window = user_data;
+ GtkWidget *file_sel;
+ GtkFileFilter *filter;
+ int i;
+
+ file_sel = gtk_file_chooser_dialog_new (_("Open"),
+ GTK_WINDOW (window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_OPEN, GTK_RESPONSE_OK,
+ NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (file_sel), GTK_RESPONSE_OK);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_sel), FALSE);
+ gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (file_sel), fr_window_get_open_default_dir
(window), NULL);
+ _gtk_dialog_add_to_window_group (GTK_DIALOG (file_sel));
+ gtk_window_set_modal (GTK_WINDOW (file_sel), TRUE);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All archives"));
+ for (i = 0; open_type[i] != -1; i++)
+ gtk_file_filter_add_mime_type (filter, mime_type_desc[open_type[i]].mime_type);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_sel), filter);
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (file_sel), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All files"));
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_sel), filter);
+
+ /**/
+
+ g_object_set_data (G_OBJECT (file_sel), "fr_window", window);
+
+ g_signal_connect (G_OBJECT (file_sel),
+ "response",
+ G_CALLBACK (open_file_response_cb),
+ file_sel);
+
+ gtk_widget_show (file_sel);
+}
+
+
+void
fr_window_activate_save_as (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -141,6 +342,87 @@ fr_window_activate_save_as (GSimpleAction *action,
void
+fr_window_activate_select_all (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_select_all (FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_sidebar_delete (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ dlg_delete_from_sidebar (NULL, FR_WINDOW (user_data));
+}
+
+
+void
+fr_window_activate_sidebar_edit_copy (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_copy_selection (FR_WINDOW (user_data), TRUE);
+}
+
+
+void
+fr_window_activate_sidebar_edit_cut (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_cut_selection (FR_WINDOW (user_data), TRUE);
+}
+
+
+void
+fr_window_activate_sidebar_edit_paste (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_paste_selection (FR_WINDOW (user_data), TRUE);
+}
+
+
+void
+fr_window_activate_sidebar_extract_files (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ dlg_extract_folder_from_sidebar (NULL, user_data);
+}
+
+
+void
+fr_window_activate_sidebar_open_folder (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_current_folder_activated (FR_WINDOW (user_data), TRUE);
+}
+
+
+void
+fr_window_activate_sidebar_rename (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_rename_selection (FR_WINDOW (user_data), TRUE);
+}
+
+
+void
+fr_window_activate_stop (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ fr_window_stop (FR_WINDOW (user_data));
+}
+
+
+void
fr_window_activate_test_archive (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -156,3 +438,34 @@ fr_window_activate_view_properties (GSimpleAction *action,
{
dlg_prop (FR_WINDOW (user_data));
}
+
+
+void
+fr_window_activate_view_selection (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ FrWindow *window = FR_WINDOW (user_data);
+ GList *file_list;
+
+ file_list = fr_window_get_file_list_selection (window, FALSE, NULL);
+ if (file_list != NULL)
+ fr_window_open_files (window, file_list, FALSE);
+
+ _g_string_list_free (file_list);
+}
+
+
+void
+fr_window_activate_view_sidebar (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GSettings *settings;
+
+ g_simple_action_set_state (action, state);
+ settings = g_settings_new (FILE_ROLLER_SCHEMA_UI);
+ g_settings_set_boolean (settings, PREF_UI_VIEW_SIDEBAR, g_variant_get_boolean (state));
+
+ g_object_unref (settings);
+}
diff --git a/src/fr-window-actions-callbacks.h b/src/fr-window-actions-callbacks.h
index 9f9fd3d..84a83ac 100644
--- a/src/fr-window-actions-callbacks.h
+++ b/src/fr-window-actions-callbacks.h
@@ -25,17 +25,42 @@
#include <gtk/gtk.h>
#include "glib-utils.h"
+GtkWidget * _gtk_application_get_current_window (GApplication *application);
+
DEF_ACTION_CALLBACK (toggle_action_activated)
DEF_ACTION_CALLBACK (fr_window_activate_add_files)
DEF_ACTION_CALLBACK (fr_window_activate_close)
-DEF_ACTION_CALLBACK (fr_window_activate_edit_find)
+DEF_ACTION_CALLBACK (fr_window_activate_delete)
+DEF_ACTION_CALLBACK (fr_window_activate_deselect_all)
+DEF_ACTION_CALLBACK (fr_window_activate_edit_copy)
+DEF_ACTION_CALLBACK (fr_window_activate_edit_cut)
DEF_ACTION_CALLBACK (fr_window_activate_edit_password)
+DEF_ACTION_CALLBACK (fr_window_activate_edit_paste)
DEF_ACTION_CALLBACK (fr_window_activate_extract_files)
+DEF_ACTION_CALLBACK (fr_window_activate_find)
DEF_ACTION_CALLBACK (fr_window_activate_go_back)
DEF_ACTION_CALLBACK (fr_window_activate_go_forward)
DEF_ACTION_CALLBACK (fr_window_activate_go_home)
+DEF_ACTION_CALLBACK (fr_window_activate_new)
+DEF_ACTION_CALLBACK (fr_window_activate_open)
+DEF_ACTION_CALLBACK (fr_window_activate_open_folder)
+DEF_ACTION_CALLBACK (fr_window_activate_open_selection)
+DEF_ACTION_CALLBACK (fr_window_activate_open_with)
+DEF_ACTION_CALLBACK (fr_window_activate_reload)
+DEF_ACTION_CALLBACK (fr_window_activate_rename)
DEF_ACTION_CALLBACK (fr_window_activate_save_as)
+DEF_ACTION_CALLBACK (fr_window_activate_select_all)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_delete)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_edit_copy)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_edit_cut)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_edit_paste)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_extract_files)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_open_folder)
+DEF_ACTION_CALLBACK (fr_window_activate_sidebar_rename)
+DEF_ACTION_CALLBACK (fr_window_activate_stop)
DEF_ACTION_CALLBACK (fr_window_activate_test_archive)
DEF_ACTION_CALLBACK (fr_window_activate_view_properties)
+DEF_ACTION_CALLBACK (fr_window_activate_view_selection)
+DEF_ACTION_CALLBACK (fr_window_activate_view_sidebar)
#endif /* FR_WINDOW_ACTION_CALLBACKS_H */
diff --git a/src/fr-window-actions-entries.h b/src/fr-window-actions-entries.h
index 1a3c02d..4595f92 100644
--- a/src/fr-window-actions-entries.h
+++ b/src/fr-window-actions-entries.h
@@ -27,24 +27,54 @@
#include "gtk-utils.h"
#include "fr-window-actions-callbacks.h"
-
static const GActionEntry fr_window_actions[] = {
{ "add-files", fr_window_activate_add_files },
{ "close", fr_window_activate_close },
- { "edit-find", toggle_action_activated, NULL, "false", fr_window_activate_edit_find },
+ { "delete", fr_window_activate_delete },
+ { "deselect-all", fr_window_activate_deselect_all },
+ { "edit-copy", fr_window_activate_edit_copy },
+ { "edit-cut", fr_window_activate_edit_cut },
{ "edit-password", fr_window_activate_edit_password },
+ { "edit-paste", fr_window_activate_edit_paste },
{ "extract-files", fr_window_activate_extract_files },
+ { "find", toggle_action_activated, NULL, "false", fr_window_activate_find },
{ "go-back", fr_window_activate_go_back },
{ "go-forward", fr_window_activate_go_forward },
{ "go-home", fr_window_activate_go_home },
+ { "open-folder", fr_window_activate_open_folder },
+ { "open-selection", fr_window_activate_open_selection },
+ { "open-with", fr_window_activate_open_with },
+ { "reload", fr_window_activate_reload },
+ { "rename", fr_window_activate_rename },
{ "save-as", fr_window_activate_save_as },
+ { "select-all", fr_window_activate_select_all },
+ { "sidebar-delete", fr_window_activate_sidebar_delete },
+ { "sidebar-edit-copy", fr_window_activate_sidebar_edit_copy },
+ { "sidebar-edit-cut", fr_window_activate_sidebar_edit_cut },
+ { "sidebar-edit-paste", fr_window_activate_sidebar_edit_paste },
+ { "sidebar-extract-files", fr_window_activate_sidebar_extract_files },
+ { "sidebar-open-folder", fr_window_activate_sidebar_open_folder },
+ { "sidebar-rename", fr_window_activate_sidebar_rename },
+ { "stop", fr_window_activate_stop },
{ "test-archive", fr_window_activate_test_archive },
{ "view-properties", fr_window_activate_view_properties },
+ { "view-selection", fr_window_activate_view_selection },
+ { "view-sidebar", toggle_action_activated, NULL, "false", fr_window_activate_view_sidebar }
};
static const FrAccelerator fr_window_accelerators[] = {
- { "close", "<Control>w" }
+ { "close", "<Control>w" },
+ { "delete", "Delete" },
+ { "deselect-all", "<Shift><Control>a" },
+ { "edit-copy", "<Control>c" },
+ { "extract-files", "<Control>e" },
+ { "find", "<Control>f" },
+ { "reload", "<Control>r" },
+ { "rename", "F2" },
+ { "select-all", "<control>a" },
+ { "view-properties", "<alt>Return" },
+ { "view-sidebar", "F9" }
};
diff --git a/src/fr-window.c b/src/fr-window.c
index 2dc8444..f3a88c9 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -31,7 +31,6 @@
#ifdef ENABLE_NOTIFICATION
# include <libnotify/notify.h>
#endif
-#include "actions.h"
#include "dlg-batch-add.h"
#include "dlg-delete.h"
#include "dlg-extract.h"
@@ -46,19 +45,16 @@
#include "fr-command.h"
#include "fr-error.h"
#include "fr-new-archive-dialog.h"
-#include "fr-stock.h"
#include "fr-window.h"
#include "fr-window-actions-entries.h"
#include "file-data.h"
#include "file-utils.h"
#include "glib-utils.h"
#include "gth-icon-cache.h"
-#include "gth-toggle-menu-action.h"
#include "fr-init.h"
#include "gtk-utils.h"
#include "open-file.h"
#include "typedefs.h"
-#include "ui.h"
#define LAST_OUTPUT_SCHEMA_NAME "LastOutput"
#define MAX_HISTORY_LEN 5
@@ -247,6 +243,7 @@ struct _FrWindowPrivate {
GtkTreePath *list_hover_path;
GtkTreeViewColumn *filename_column;
GtkWindowGroup *window_group;
+ GtkAccelGroup *accel_group;
GHashTable *named_dialogs;
gboolean filter_mode;
@@ -318,8 +315,6 @@ struct _FrWindowPrivate {
FrArchive *copy_from_archive;
GFile *saving_file;
- GtkActionGroup *actions;
-
GtkWidget *file_popup_menu;
GtkWidget *folder_popup_menu;
GtkWidget *sidebar_folder_popup_menu;
@@ -674,6 +669,9 @@ fr_window_finalize (GObject *object)
fr_window_free_open_files (window);
+ g_object_unref (window->priv->window_group);
+ g_object_unref (window->priv->accel_group);
+
if (window->archive != NULL) {
g_object_unref (window->archive);
window->archive = NULL;
@@ -708,14 +706,36 @@ fr_window_enable_action (FrWindow *window,
static void
-set_sensitive (FrWindow *window,
- const char *action_name,
- gboolean sensitive)
+fr_window_set_action_state (FrWindow *window,
+ const char *action_name,
+ gboolean active)
{
- GtkAction *action;
+ GAction *action;
- action = gtk_action_group_get_action (window->priv->actions, action_name);
- g_object_set (action, "sensitive", sensitive, NULL);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), action_name);
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (active));
+}
+
+
+static void
+fr_window_change_action_state (FrWindow *window,
+ const char *action_name,
+ gboolean value)
+{
+ GAction *action;
+ GVariant *old_state;
+ GVariant *new_state;
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), action_name);
+ g_return_if_fail (action != NULL);
+
+ old_state = g_action_get_state (action);
+ new_state = g_variant_new_boolean (value);
+ if ((old_state == NULL) || ! g_variant_equal (old_state, new_state))
+ g_action_change_state (action, new_state);
+
+ if (old_state != NULL)
+ g_variant_unref (old_state);
}
@@ -736,6 +756,7 @@ fr_window_update_paste_command_sensitivity (FrWindow *window,
no_archive = (window->archive == NULL) || ! window->priv->archive_present;
ro = ! no_archive && window->archive->read_only;
+#if 0
set_sensitive (window, "Paste",
! no_archive
&& ! ro
@@ -743,6 +764,15 @@ fr_window_update_paste_command_sensitivity (FrWindow *window,
&& fr_archive_is_capable_of (window->archive, FR_ARCHIVE_CAN_STORE_MANY_FILES)
&& (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)
&& gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
+#endif
+
+ fr_window_enable_action (window, "edit-paste",
+ ! no_archive
+ && ! ro
+ && ! running
+ && fr_archive_is_capable_of (window->archive,
FR_ARCHIVE_CAN_STORE_MANY_FILES)
+ && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)
+ && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
}
@@ -887,9 +917,12 @@ fr_window_init (FrWindow *window)
window->priv->cancellable = g_cancellable_new ();
window->priv->compression = FR_COMPRESSION_NORMAL;
window->priv->window_group = gtk_window_group_new ();
+ window->priv->accel_group = gtk_accel_group_new ();
window->priv->populating_file_list = FALSE;
window->priv->named_dialogs = g_hash_table_new (g_str_hash, g_str_equal);
+
gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (window));
+ gtk_window_add_accel_group (GTK_WINDOW (window), window->priv->accel_group);
window->archive = NULL;
}
@@ -1100,6 +1133,7 @@ fr_window_update_sensitivity (FrWindow *window)
one_file_selected = n_selected == 1;
dir_selected = selection_has_a_dir (window);
+#if 0
set_sensitive (window, "Add", ! no_archive && ! ro && ! running && can_store_many_files);
set_sensitive (window, "Add_Toolbar", ! no_archive && ! ro && ! running && can_store_many_files);
set_sensitive (window, "Copy", ! no_archive && ! ro && ! running && can_store_many_files &&
sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
@@ -1124,6 +1158,7 @@ fr_window_update_sensitivity (FrWindow *window)
set_sensitive (window, "TestArchive", ! no_archive && ! running && window->archive->propTest);
set_sensitive (window, "ViewSelection", file_op && one_file_selected && ! dir_selected);
set_sensitive (window, "ViewSelection_Toolbar", file_op && one_file_selected && ! dir_selected);
+#endif
if (window->priv->progress_dialog != NULL)
gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog),
@@ -1132,6 +1167,7 @@ fr_window_update_sensitivity (FrWindow *window)
fr_window_update_paste_command_sensitivity (window, NULL);
+#if 0
set_sensitive (window, "SelectAll", (window->priv->current_view_length > 0) &&
(window->priv->current_view_length != n_selected));
set_sensitive (window, "DeselectAll", n_selected > 0);
@@ -1139,15 +1175,23 @@ fr_window_update_sensitivity (FrWindow *window)
set_sensitive (window, "ViewAllFiles", ! window->priv->filter_mode);
set_sensitive (window, "ViewAsFolder", ! window->priv->filter_mode);
+#endif
fr_window_enable_action (window, "add-files", ! no_archive && ! ro && ! running &&
can_store_many_files);
fr_window_enable_action (window, "close", ! running || window->priv->stoppable);
+ fr_window_enable_action (window, "delete", ! no_archive && ! ro && ! window->priv->archive_new && !
running && can_store_many_files);
+ fr_window_enable_action (window, "edit-copy", ! no_archive && ! ro && ! running &&
can_store_many_files && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+ fr_window_enable_action (window, "edit-cut", ! no_archive && ! ro && ! running &&
can_store_many_files && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
fr_window_enable_action (window, "edit-password", ! running && (window->priv->asked_for_password ||
(! no_archive && window->archive->propPassword)));
fr_window_enable_action (window, "extract-files", file_op);
- fr_window_enable_action (window, "edit-find", ! no_archive);
+ fr_window_enable_action (window, "find", ! no_archive);
+ fr_window_enable_action (window, "open-folder", file_op && one_file_selected && dir_selected);
+ fr_window_enable_action (window, "open-selection", file_op && sel_not_null && ! dir_selected);
+ fr_window_enable_action (window, "rename", ! no_archive && ! ro && ! running && can_store_many_files
&& one_file_selected);
fr_window_enable_action (window, "save-as", ! no_archive && can_store_many_files && ! running);
fr_window_enable_action (window, "test-archive", ! no_archive && ! running &&
window->archive->propTest);
fr_window_enable_action (window, "view-properties", file_op);
+ fr_window_enable_action (window, "view-selection", file_op && one_file_selected && ! dir_selected);
}
@@ -1664,7 +1708,8 @@ get_tree_iter_from_path (FrWindow *window,
break;
}
g_free (iter_path);
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (window->priv->tree_store), iter));
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (window->priv->tree_store), iter));
return result;
}
@@ -1673,10 +1718,7 @@ get_tree_iter_from_path (FrWindow *window,
static void
fr_window_deactivate_filter (FrWindow *window)
{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->actions, "Find");
- g_object_set (action, "active", FALSE, NULL);
+ fr_window_change_action_state (window, "find", FALSE);
}
@@ -1694,11 +1736,6 @@ fr_window_update_current_location (FrWindow *window)
gtk_entry_set_text (GTK_ENTRY (window->priv->location_entry), window->priv->archive_present?
current_dir: "");
- set_sensitive (window, "GoBack", window->priv->archive_present && (current_dir != NULL) &&
(window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
- set_sensitive (window, "GoForward", window->priv->archive_present && (current_dir != NULL) &&
(window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
- set_sensitive (window, "GoUp", window->priv->archive_present && (current_dir != NULL) && (strcmp
(current_dir, "/") != 0));
- set_sensitive (window, "GoHome", window->priv->archive_present);
-
fr_window_enable_action (window, "go-back", window->priv->archive_present && (current_dir != NULL) &&
(window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
fr_window_enable_action (window, "go-forward", window->priv->archive_present && (current_dir != NULL)
&& (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
fr_window_enable_action (window, "go-home", window->priv->archive_present);
@@ -2052,7 +2089,7 @@ progress_dialog_delete_event (GtkWidget *caller,
FrWindow *window)
{
if (window->priv->stoppable) {
- activate_action_stop (NULL, window);
+ fr_window_stop (window);
close_progress_dialog (window, TRUE);
}
@@ -2129,7 +2166,7 @@ progress_dialog_response (GtkDialog *dialog,
switch (response_id) {
case GTK_RESPONSE_CANCEL:
if (window->priv->stoppable) {
- activate_action_stop (NULL, window);
+ fr_window_stop (window);
close_progress_dialog (window, TRUE);
}
break;
@@ -2399,11 +2436,11 @@ create_the_progress_dialog (FrWindow *window)
_gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
- window->priv->pd_quit_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_QUIT,
DIALOG_RESPONSE_QUIT);
+ window->priv->pd_quit_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Quit"),
DIALOG_RESPONSE_QUIT);
window->priv->pd_open_archive_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Open the
Archive"), DIALOG_RESPONSE_OPEN_ARCHIVE);
window->priv->pd_open_destination_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Show the
Files"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER);
- window->priv->pd_close_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE);
- window->priv->pd_cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
+ window->priv->pd_close_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _GTK_LABEL_CLOSE,
GTK_RESPONSE_CLOSE);
+ window->priv->pd_cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _GTK_LABEL_CANCEL,
GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
window->priv->progress_dialog = dialog;
@@ -3992,12 +4029,12 @@ fr_window_drag_data_received (GtkWidget *widget,
d = _gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
_("Do you want to add this file to the current archive
or open it as a new archive?"),
NULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_ADD, 0,
- GTK_STOCK_OPEN, 1,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_ADD, 0,
+ _GTK_LABEL_OPEN, 1,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), 2);
@@ -4022,10 +4059,10 @@ fr_window_drag_data_received (GtkWidget *widget,
d = _gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
_("Do you want to create a new archive with these
files?"),
NULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
_("Create _Archive"), GTK_RESPONSE_YES,
NULL);
@@ -4325,9 +4362,7 @@ wait_dnd_extraction (FrWindow *window)
&wait_info,
(GDestroyNotify) notify_extraction_finished);
- gdk_threads_leave ();
g_main_loop_run (wait_info.loop);
- gdk_threads_enter ();
g_main_loop_unref (wait_info.loop);
wait_info.loop = NULL;
@@ -4575,7 +4610,7 @@ key_press_cb (GtkWidget *widget,
switch (event->keyval) {
case GDK_KEY_Escape:
- activate_action_stop (NULL, window);
+ fr_window_stop (window);
if (window->priv->filter_mode)
fr_window_deactivate_filter (window);
retval = TRUE;
@@ -5043,18 +5078,6 @@ path_column_sort_func (GtkTreeModel *model,
}
-static void
-set_active (FrWindow *window,
- const char *action_name,
- gboolean is_active)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->actions, action_name);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_active);
-}
-
-
static gboolean
fr_window_show_cb (GtkWidget *widget,
FrWindow *window)
@@ -5062,7 +5085,7 @@ fr_window_show_cb (GtkWidget *widget,
fr_window_update_current_location (window);
window->priv->view_sidebar = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_SIDEBAR);
- set_active (window, "ViewSidebar", window->priv->view_sidebar);
+ fr_window_set_action_state (window, "view-sidebar", window->priv->view_sidebar);
gtk_widget_hide (window->priv->filter_bar);
@@ -5154,16 +5177,6 @@ fr_archive_stoppable_cb (FrArchive *archive,
static void
-view_as_radio_action (GtkAction *action,
- GtkRadioAction *current,
- gpointer data)
-{
- FrWindow *window = data;
- fr_window_set_list_mode (window, gtk_radio_action_get_current_value (current));
-}
-
-
-static void
fr_window_activate_filter (FrWindow *window)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (window->priv->list_view);
@@ -5240,6 +5253,42 @@ fr_window_attach (FrWindow *window,
}
+/* -- fr_window_add_accelerators -- */
+
+
+static GtkAccelGroup *
+gth_window_get_accel_group (FrWindow *window)
+{
+ if (window->priv->accel_group == NULL) {
+ window->priv->accel_group = gtk_accel_group_new ();
+ gtk_window_add_accel_group (GTK_WINDOW (window), window->priv->accel_group);
+ }
+
+ return window->priv->accel_group;
+}
+
+
+static void
+fr_window_add_accelerators (FrWindow *window,
+ const FrAccelerator *accelerators,
+ int n_accelerators)
+{
+ GtkAccelGroup *accel_group;
+ int i;
+
+ accel_group = gth_window_get_accel_group (window);
+ for (i = 0; i < n_accelerators; i++) {
+ const FrAccelerator *acc = accelerators + i;
+
+ _gtk_window_add_accelerator_for_action (GTK_WINDOW (window),
+ accel_group,
+ acc->action_name,
+ acc->accelerator,
+ NULL);
+ }
+}
+
+
static void
fr_window_construct (FrWindow *window)
{
@@ -5250,10 +5299,7 @@ fr_window_construct (FrWindow *window)
GtkWidget *filter_box;
GtkWidget *tree_scrolled_window;
GtkTreeSelection *selection;
- GtkActionGroup *actions;
- GtkUIManager *ui;
GtkSizeGroup *toolbar_size_group;
- GError *error = NULL;
const char * const *schemas;
/* Create the settings objects */
@@ -5557,47 +5603,9 @@ fr_window_construct (FrWindow *window)
fr_window_actions,
G_N_ELEMENTS (fr_window_actions),
window);
- /*fr_window_add_accelerators (window,
- fr_window_accelerators,
- G_N_ELEMENTS (fr_window_accelerators)); FIXME */
-
- /* Build the menu. */
-
- ui = gtk_ui_manager_new ();
-
- window->priv->actions = actions = gtk_action_group_new ("Actions");
-
- /* other actions */
-
- gtk_action_group_set_translation_domain (actions, NULL);
- gtk_action_group_add_actions (actions,
- action_entries,
- n_action_entries,
- window);
- gtk_action_group_add_toggle_actions (actions,
- action_toggle_entries,
- n_action_toggle_entries,
- window);
- gtk_action_group_add_radio_actions (actions,
- view_as_entries,
- n_view_as_entries,
- window->priv->list_mode,
- G_CALLBACK (view_as_radio_action),
- window);
-
- gtk_ui_manager_insert_action_group (ui, actions, 0);
- gtk_window_add_accel_group (GTK_WINDOW (window),
- gtk_ui_manager_get_accel_group (ui));
-
- /* Add a hidden short cut Ctrl-Q for power users */
- gtk_accel_group_connect (gtk_ui_manager_get_accel_group (ui),
- GDK_KEY_q, GDK_CONTROL_MASK, 0,
- g_cclosure_new_swap (G_CALLBACK (fr_window_close), window, NULL));
-
- if (! gtk_ui_manager_add_ui_from_resource (ui, "/org/gnome/FileRoller/ui/menus-toolbars.ui", &error))
{
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
+ fr_window_add_accelerators (window,
+ fr_window_accelerators,
+ G_N_ELEMENTS (fr_window_accelerators));
/* header bar */
@@ -5619,7 +5627,7 @@ fr_window_construct (FrWindow *window)
gtk_header_bar_pack_end (GTK_HEADER_BAR (window->priv->headerbar),
_gtk_header_bar_create_image_toggle_button ("edit-find-symbolic",
_("Find files by name"),
- "win.edit-find"));
+ "win.find"));
/* gears menu button */
@@ -5697,10 +5705,22 @@ fr_window_construct (FrWindow *window)
gtk_widget_show (window->priv->location_bar);
/* popup menus */
+ {
+ GtkBuilder *builder;
+
+ builder = _gtk_builder_new_from_resource ("menus.ui");
- window->priv->file_popup_menu = gtk_ui_manager_get_widget (ui, "/FilePopupMenu");
- window->priv->folder_popup_menu = gtk_ui_manager_get_widget (ui, "/FolderPopupMenu");
- window->priv->sidebar_folder_popup_menu = gtk_ui_manager_get_widget (ui, "/SidebarFolderPopupMenu");
+ window->priv->file_popup_menu = gtk_menu_new_from_model (G_MENU_MODEL (gtk_builder_get_object
(builder, "file-popup")));
+ gtk_menu_attach_to_widget (GTK_MENU (window->priv->file_popup_menu), GTK_WIDGET (window),
NULL);
+
+ window->priv->folder_popup_menu = gtk_menu_new_from_model (G_MENU_MODEL
(gtk_builder_get_object (builder, "folder-popup")));
+ gtk_menu_attach_to_widget (GTK_MENU (window->priv->folder_popup_menu), GTK_WIDGET (window),
NULL);
+
+ window->priv->sidebar_folder_popup_menu = gtk_menu_new_from_model (G_MENU_MODEL
(gtk_builder_get_object (builder, "sidebar-popup")));
+ gtk_menu_attach_to_widget (GTK_MENU (window->priv->sidebar_folder_popup_menu), GTK_WIDGET
(window), NULL);
+
+ g_object_unref (builder);
+ }
/**/
@@ -6440,10 +6460,10 @@ query_info_ready_for_overwrite_dialog_cb (GObject *source_object,
details = g_strdup_printf (_("Another file with the same name already exists in \"%s\"."),
parent_name);
d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
msg,
details,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
_("Replace _All"), _FR_RESPONSE_OVERWRITE_YES_ALL,
_("_Skip"), _FR_RESPONSE_OVERWRITE_NO,
_("_Replace"), _FR_RESPONSE_OVERWRITE_YES,
@@ -6519,10 +6539,10 @@ _fr_window_ask_overwrite_dialog (OverwriteData *odata)
d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
0,
- GTK_STOCK_DIALOG_WARNING,
+ _GTK_ICON_NAME_DIALOG_WARNING,
_("Extraction not performed"),
NULL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _GTK_LABEL_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
fr_window_show_error_dialog (odata->window, d, GTK_WINDOW (odata->window), _("Extraction not
performed"));
@@ -6622,10 +6642,10 @@ fr_window_archive_extract (FrWindow *window,
d = _gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
msg,
NULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
_("Create _Folder"), GTK_RESPONSE_YES,
NULL);
@@ -6666,10 +6686,10 @@ fr_window_archive_extract (FrWindow *window,
d = _gtk_message_dialog_new (GTK_WINDOW (window),
0,
- GTK_STOCK_DIALOG_WARNING,
+ _GTK_ICON_NAME_DIALOG_WARNING,
_("Extraction not performed"),
NULL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _GTK_LABEL_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
fr_window_show_error_dialog (window, d, GTK_WINDOW (window), _("Extraction not performed"));
@@ -7700,7 +7720,7 @@ fr_window_view_last_output (FrWindow *window,
dialog = gtk_dialog_new_with_buttons (title,
GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ _GTK_LABEL_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
@@ -8039,7 +8059,7 @@ fr_window_rename_selection (FrWindow *window,
(renaming_dir ? _("_New folder name:") : _("_New file
name:")),
utf8_old_name,
1024,
- GTK_STOCK_CANCEL,
+ _GTK_LABEL_CANCEL,
_("_Rename"));
g_free (utf8_old_name);
@@ -8075,10 +8095,10 @@ fr_window_rename_selection (FrWindow *window,
dlg = _gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
+ _GTK_ICON_NAME_DIALOG_QUESTION,
(renaming_dir ? _("Could not rename the folder") :
_("Could not rename the file")),
reason,
- GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+ _GTK_LABEL_CLOSE, GTK_RESPONSE_OK,
NULL);
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
@@ -8567,8 +8587,8 @@ fr_window_paste_selection (FrWindow *window,
_("_Destination folder:"),
utf8_old_path,
1024,
- GTK_STOCK_CANCEL,
- GTK_STOCK_PASTE);
+ _GTK_LABEL_CANCEL,
+ _("_Paste"));
g_free (utf8_old_path);
if (utf8_path == NULL)
return;
@@ -9090,7 +9110,7 @@ fr_window_set_folders_visibility (FrWindow *window,
window->priv->view_sidebar = value;
fr_window_update_dir_tree (window);
- set_active (window, "ViewSidebar", window->priv->view_sidebar);
+ fr_window_set_action_state (window, "view-sidebar", window->priv->view_sidebar);
}
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 55d44cd..af47ea0 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -54,7 +54,7 @@ _gtk_tree_selection_count_selected (GtkTreeSelection *selection)
GtkWidget *
_gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
- const char *stock_id,
+ const char *icon_name,
const char *message,
const char *secondary_message,
const gchar *first_button_text,
@@ -80,9 +80,9 @@ _gtk_message_dialog_new (GtkWindow *parent,
/* set the icon */
- gtk_image_set_from_stock (GTK_IMAGE (_gtk_builder_get_widget (builder, "icon_image")),
- stock_id,
- GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_icon_name (GTK_IMAGE (_gtk_builder_get_widget (builder, "icon_image")),
+ icon_name,
+ GTK_ICON_SIZE_DIALOG);
/* set the message */
@@ -139,33 +139,12 @@ _gtk_message_dialog_new (GtkWindow *parent,
static GtkWidget *
-create_button (const char *stock_id,
- const char *text)
-{
- GtkWidget *button;
- GtkWidget *image;
- const char *label_text;
- gboolean text_is_stock;
- GtkStockItem stock_item;
-
- if (gtk_stock_lookup (text, &stock_item)) {
- label_text = stock_item.label;
- text_is_stock = TRUE;
- }
- else {
- label_text = text;
- text_is_stock = FALSE;
- }
-
- if (text_is_stock)
- image = gtk_image_new_from_stock (text, GTK_ICON_SIZE_BUTTON);
- else
- image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
- button = gtk_button_new_with_mnemonic (label_text);
- gtk_button_set_image (GTK_BUTTON (button), image);
+create_button (const char *text)
+{
+ GtkWidget *button;
+ button = gtk_button_new_with_mnemonic (text);
gtk_widget_set_can_default (button, TRUE);
-
gtk_widget_show (button);
return button;
@@ -210,10 +189,10 @@ _gtk_request_dialog_run (GtkWindow *parent,
/* Add buttons */
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
- create_button (GTK_STOCK_CANCEL, no_button_text),
+ create_button (no_button_text),
GTK_RESPONSE_CANCEL);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
- create_button (GTK_STOCK_OK, yes_button_text),
+ create_button (yes_button_text),
GTK_RESPONSE_YES);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
@@ -335,10 +314,10 @@ _gtk_error_dialog_run (GtkWindow *parent,
d = _gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_ERROR,
+ _GTK_ICON_NAME_DIALOG_ERROR,
main_message,
message,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
+ _GTK_LABEL_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
g_free (message);
@@ -553,10 +532,10 @@ _gtk_show_help_dialog (GtkWindow *parent,
dialog = _gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_DIALOG_ERROR,
+ _GTK_ICON_NAME_DIALOG_ERROR,
_("Could not display help"),
error->message,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _GTK_LABEL_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -625,9 +604,10 @@ _gtk_widget_lookup_for_size (GtkWidget *widget,
GtkIconSize icon_size)
{
int w, h;
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
- icon_size,
- &w, &h);
+
+ if (! gtk_icon_size_lookup (icon_size, &w, &h))
+ w = h = 16;
+
return MAX (w, h);
}
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index 7da18d8..f6f366b 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -26,6 +26,21 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
+#define _GTK_ICON_NAME_DIALOG_ERROR "dialog-error-symbolic"
+#define _GTK_ICON_NAME_DIALOG_INFO "dialog-information-symbolic"
+#define _GTK_ICON_NAME_DIALOG_QUESTION "dialog-question-symbolic"
+#define _GTK_ICON_NAME_DIALOG_WARNING "dialog-warning-symbolic"
+
+#define _GTK_LABEL_ADD _("_Add")
+#define _GTK_LABEL_CANCEL _("_Cancel")
+#define _GTK_LABEL_CLOSE _("_Close")
+#define _GTK_LABEL_CREATE_ARCHIVE _("C_reate")
+#define _GTK_LABEL_EXTRACT _("_Extract")
+#define _GTK_LABEL_OK _("_Ok")
+#define _GTK_LABEL_OPEN _("_Open")
+#define _GTK_LABEL_SAVE _("_Save")
+
+
typedef struct {
const char *action_name;
const char *accelerator;
@@ -34,7 +49,7 @@ typedef struct {
int _gtk_tree_selection_count_selected (GtkTreeSelection *selection);
GtkWidget * _gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
- const char *stock_id,
+ const char *icon_name,
const char *message,
const char *secondary_message,
const char *first_button_text,
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index a89ba68..c32e04b 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -9,6 +9,7 @@ EXTRA_DIST = \
extract-dialog-options.ui \
file-selector.ui \
gears-menu.ui \
+ menus.ui \
menus-toolbars.ui \
message-dialog.ui \
new-archive-dialog.ui \
diff --git a/src/ui/app-menu.ui b/src/ui/app-menu.ui
index f95e7f9..25d6135 100644
--- a/src/ui/app-menu.ui
+++ b/src/ui/app-menu.ui
@@ -4,10 +4,12 @@
<item>
<attribute name="action">app.new</attribute>
<attribute name="label" translatable="yes">_New Archive</attribute>
+ <attribute name="accel"><![CDATA[<Ctrl>n]]></attribute>
</item>
<item>
<attribute name="action">app.open</attribute>
<attribute name="label" translatable="yes">_Open…</attribute>
+ <attribute name="accel"><![CDATA[<Ctrl>o]]></attribute>
</item>
</section>
<section>
@@ -32,6 +34,7 @@
<item>
<attribute name="action">app.help</attribute>
<attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="accel">F1</attribute>
</item>
<item>
<attribute name="action">app.about</attribute>
@@ -40,6 +43,7 @@
<item>
<attribute name="action">app.quit</attribute>
<attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="accel"><![CDATA[<Ctrl>q]]></attribute>
</item>
</section>
</menu>
diff --git a/src/ui/gears-menu.ui b/src/ui/gears-menu.ui
index 4a38d0b..15f0eef 100644
--- a/src/ui/gears-menu.ui
+++ b/src/ui/gears-menu.ui
@@ -27,6 +27,7 @@
<item>
<attribute name="label" translatable="yes">Close</attribute>
<attribute name="action">win.close</attribute>
+ <attribute name="accel"><![CDATA[<Control>w]]></attribute>
</item>
</section>
</menu>
diff --git a/src/ui/menus.ui b/src/ui/menus.ui
new file mode 100644
index 0000000..e9c12eb
--- /dev/null
+++ b/src/ui/menus.ui
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="file-popup">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Open</attribute>
+ <attribute name="action">win.view-selection</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Open With…</attribute>
+ <attribute name="action">win.open-selection</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Extract…</attribute>
+ <attribute name="action">win.extract-files</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Cut</attribute>
+ <attribute name="action">win.edit-cut</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Copy</attribute>
+ <attribute name="action">win.edit-copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Paste</attribute>
+ <attribute name="action">win.edit-paste</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Rename…</attribute>
+ <attribute name="action">win.rename</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Delete</attribute>
+ <attribute name="action">win.delete</attribute>
+ </item>
+ </section>
+ </menu>
+ <menu id="folder-popup">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Open</attribute>
+ <attribute name="action">win.open-folder</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Extract…</attribute>
+ <attribute name="action">win.extract-files</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Cut</attribute>
+ <attribute name="action">win.edit-cut</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Copy</attribute>
+ <attribute name="action">win.edit-copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Paste</attribute>
+ <attribute name="action">win.edit-paste</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Rename…</attribute>
+ <attribute name="action">win.rename</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Delete</attribute>
+ <attribute name="action">win.delete</attribute>
+ </item>
+ </section>
+ </menu>
+ <menu id="sidebar-popup">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Open</attribute>
+ <attribute name="action">win.sidebar-open-folder</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Extract…</attribute>
+ <attribute name="action">win.sidebar-extract-files</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Cut</attribute>
+ <attribute name="action">win.sidebar-edit-cut</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Copy</attribute>
+ <attribute name="action">win.sidebar-edit-copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Paste</attribute>
+ <attribute name="action">win.sidebar-edit-paste</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Rename…</attribute>
+ <attribute name="action">win.sidebar-rename</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Delete</attribute>
+ <attribute name="action">win.sidebar-delete</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]