[nautilus-actions] Refactoring of menubar files
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Refactoring of menubar files
- Date: Thu, 3 Feb 2011 01:56:43 +0000 (UTC)
commit da05f6e87f16fd8818442ecb23108550afe7e3ef
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Feb 3 02:56:24 2011 +0100
Refactoring of menubar files
+ nact-main-menubar-*.c are renamed as nact-menubar-*.c
+ nact-main-menubar-*.h are removed.
ChangeLog | 12 ++
src/nact/Makefile.am | 18 +--
src/nact/nact-confirm-logout.c | 4 +-
src/nact/nact-iactions-list.c | 3 +-
src/nact/nact-main-menubar-edit.h | 57 ------
src/nact/nact-main-menubar-file.h | 57 ------
src/nact/nact-main-menubar-help.h | 51 -----
src/nact/nact-main-menubar-maintainer.h | 53 ------
src/nact/nact-main-menubar-tools.h | 51 -----
src/nact/nact-main-menubar-view.h | 55 ------
src/nact/nact-main-window.c | 38 +---
src/nact/nact-main-window.h | 3 +-
...act-main-menubar-edit.c => nact-menubar-edit.c} | 59 +++---
...act-main-menubar-file.c => nact-menubar-file.c} | 57 +++---
...act-main-menubar-help.c => nact-menubar-help.c} | 15 +-
...ubar-maintainer.c => nact-menubar-maintainer.c} | 22 +-
src/nact/nact-menubar-priv.h | 59 ++++++-
...t-main-menubar-tools.c => nact-menubar-tools.c} | 13 +-
...act-main-menubar-view.c => nact-menubar-view.c} | 29 ++--
src/nact/nact-menubar.c | 196 ++++++++++----------
src/nact/nact-menubar.h | 8 +-
21 files changed, 288 insertions(+), 572 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 354740d..20b067a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2011-02-02 Pierre Wieser <pwieser trychlos org>
+ Refactoring of menubar files:
+ - nact-main-menubar-*.c are renamed as nact-menubar-*.c.
+ - nact-main-menubar-*.h are removed.
+
+ * src/nact/Makefile.am:
+ * src/nact/nact-confirm-logout.c:
+ * src/nact/nact-iactions-list.c: Updated accordingly.
+
+ * src/nact/nact-main-window.c:
+ * src/nact/nact-main-window.h: Remove MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES
+ which is replaced by NactMenubar internal MENUBAR_SIGNAL_UPDATE_SENSITIVITIES one.
+
Termination of the main window is managed in NactMainWindow.
* src/nact/nact-main-window.c:
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index b5c486f..9d77dc8 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -115,18 +115,6 @@ nautilus_actions_config_tool_SOURCES = \
nact-iproperties-tab.h \
nact-ischemes-tab.c \
nact-ischemes-tab.h \
- nact-main-menubar-edit.c \
- nact-main-menubar-edit.h \
- nact-main-menubar-file.c \
- nact-main-menubar-file.h \
- nact-main-menubar-help.c \
- nact-main-menubar-help.h \
- nact-main-menubar-maintainer.c \
- nact-main-menubar-maintainer.h \
- nact-main-menubar-tools.c \
- nact-main-menubar-tools.h \
- nact-main-menubar-view.c \
- nact-main-menubar-view.h \
nact-main-statusbar.c \
nact-main-statusbar.h \
nact-main-tab.c \
@@ -140,6 +128,12 @@ nautilus_actions_config_tool_SOURCES = \
nact-menubar.c \
nact-menubar.h \
nact-menubar-priv.h \
+ nact-menubar-edit.c \
+ nact-menubar-file.c \
+ nact-menubar-help.c \
+ nact-menubar-maintainer.c \
+ nact-menubar-tools.c \
+ nact-menubar-view.c \
nact-preferences-editor.c \
nact-preferences-editor.h \
nact-providers-list.c \
diff --git a/src/nact/nact-confirm-logout.c b/src/nact/nact-confirm-logout.c
index 1266a44..490fe68 100644
--- a/src/nact/nact-confirm-logout.c
+++ b/src/nact/nact-confirm-logout.c
@@ -33,7 +33,7 @@
#endif
#include "nact-confirm-logout.h"
-#include "nact-main-menubar-file.h"
+#include "nact-menubar.h"
/* private class data
*/
@@ -266,7 +266,7 @@ on_save_and_quit_clicked( GtkButton *button, NactConfirmLogout *editor )
g_debug( "%s: button=%p, editor=%p", thisfn, ( void * ) button, ( void * ) editor );
main_window = NACT_MAIN_WINDOW( base_window_get_parent( BASE_WINDOW( editor )));
- nact_main_menubar_file_save_items( main_window );
+ nact_menubar_save_items( BASE_WINDOW( main_window ));
close_dialog( editor, TRUE );
}
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 26ca779..69818d5 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -1298,10 +1298,11 @@ open_popup( NactIActionsList *instance, GdkEventButton *event )
GtkTreePath *path;
treeview = nact_iactions_list_priv_get_actions_list_treeview( instance );
+
if( gtk_tree_view_get_path_at_pos( treeview, event->x, event->y, &path, NULL, NULL, NULL )){
model = gtk_tree_view_get_model( treeview );
nact_iactions_list_bis_select_row_at_path( instance, treeview, model, path );
gtk_tree_path_free( path );
- nact_main_menubar_open_popup( NACT_MAIN_WINDOW( instance ), event );
+ nact_menubar_open_popup( BASE_WINDOW( instance ), event );
}
}
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index c1a0319..aad8615 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -53,7 +53,6 @@
#include "nact-iexecution-tab.h"
#include "nact-iproperties-tab.h"
#include "nact-main-tab.h"
-#include "nact-main-menubar-file.h"
#include "nact-main-statusbar.h"
#include "nact-marshal.h"
#include "nact-main-window.h"
@@ -132,7 +131,6 @@ enum {
PROVIDER_CHANGED,
SELECTION_CHANGED,
ITEM_UPDATED,
- UPDATE_SENSITIVITIES,
ORDER_CHANGED,
LAST_SIGNAL
};
@@ -452,24 +450,6 @@ class_init( NactMainWindowClass *klass )
G_TYPE_BOOLEAN );
/**
- * main-window-update-sensitivities:
- *
- * This signal is emitted each time a user interaction may led the
- * action sensitivities to be updated.
- */
- st_signals[ UPDATE_SENSITIVITIES ] = g_signal_new(
- MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES,
- G_TYPE_OBJECT,
- G_SIGNAL_RUN_LAST,
- 0, /* no default handler */
- NULL,
- NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE,
- 1,
- G_TYPE_POINTER );
-
- /**
* main-window-level-zero-order-changed:
*
* This signal is emitted each time a user interaction may led the
@@ -1152,15 +1132,19 @@ nact_main_window_quit( NactMainWindow *window )
gboolean has_modified;
gboolean terminated;
- g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
- g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
+ g_return_val_if_fail( NACT_IS_MAIN_WINDOW( window ), FALSE );
terminated = FALSE;
- has_modified = nact_main_window_has_modified_items( window );
- if( !has_modified || nact_window_warn_modified( NACT_WINDOW( window ))){
- g_object_unref( window );
- terminated = TRUE;
+ if( !window->private->dispose_has_run ){
+ g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
+
+ has_modified = nact_main_window_has_modified_items( window );
+
+ if( !has_modified || nact_window_warn_modified( NACT_WINDOW( window ))){
+ g_object_unref( window );
+ terminated = TRUE;
+ }
}
return( terminated );
@@ -1245,7 +1229,7 @@ nact_main_window_has_modified_items( const NactMainWindow *window )
g_debug( "%s: has_modified=%s", thisfn, has_modified ? "True":"False" );
}
- return( count_deleted > 0 || has_modified || nact_main_menubar_is_level_zero_order_changed( window ));
+ return( count_deleted > 0 || has_modified || nact_menubar_is_level_zero_order_changed( window ));
}
/**
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index 63afe59..63f8696 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -82,7 +82,6 @@ typedef struct {
NactMainWindowClass;
#define MAIN_WINDOW_SIGNAL_SELECTION_CHANGED "main-window-selection-changed"
-#define MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES "main-window-update-sensitivities"
#define MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED "main-window-level-zero-order-changed"
GType nact_main_window_get_type( void );
@@ -96,7 +95,7 @@ void nact_main_window_move_to_deleted ( NactMainWindow *window, GLi
void nact_main_window_reload ( NactMainWindow *window );
gboolean nact_main_window_remove_deleted ( NactMainWindow *window, GSList **messages );
-void nact_main_window_quit ( NactMainWindow *window );
+gboolean nact_main_window_quit ( NactMainWindow *window );
G_END_DECLS
diff --git a/src/nact/nact-main-menubar-edit.c b/src/nact/nact-menubar-edit.c
similarity index 90%
rename from src/nact/nact-main-menubar-edit.c
rename to src/nact/nact-menubar-edit.c
index 4c7fe6b..f1e2d62 100644
--- a/src/nact/nact-main-menubar-edit.c
+++ b/src/nact/nact-menubar-edit.c
@@ -42,7 +42,6 @@
#include "nact-application.h"
#include "nact-iactions-list.h"
#include "nact-main-tab.h"
-#include "nact-main-menubar-edit.h"
#include "nact-menubar-priv.h"
#include "nact-preferences-editor.h"
@@ -53,7 +52,7 @@ static gchar *add_non_deletable_msg( const NAObjectItem *item, gint reason );
static void update_clipboard_counters( NactMainWindow *window );
/**
- * nact_main_menubar_edit_on_update_sensitivities:
+ * nact_menubar_edit_on_update_sensitivities:
* @window: the #NactMainWindow main window.
* user_data: the data passed to the function via the signal.
* @mis: the #MenubarIndicatorsStruct struct.
@@ -61,7 +60,7 @@ static void update_clipboard_counters( NactMainWindow *window );
* Update sensitivity of items of the Edit menu.
*/
void
-nact_main_menubar_edit_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_edit_on_update_sensitivities( const NactMenubar *bar )
{
gboolean cut_enabled;
gboolean copy_enabled;
@@ -174,7 +173,7 @@ nact_main_menubar_edit_on_update_sensitivities( NactMenubar *bar )
}
/**
- * nact_main_menubar_edit_on_cut:
+ * nact_menubar_edit_on_cut:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -186,9 +185,9 @@ nact_main_menubar_edit_on_update_sensitivities( NactMenubar *bar )
* - (tree) remove selected items, unreffing objects
*/
void
-nact_main_menubar_edit_on_cut( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_cut( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_cut";
+ static const gchar *thisfn = "nact_menubar_edit_on_cut";
NactApplication *application;
NAUpdater *updater;
GList *items;
@@ -229,7 +228,7 @@ nact_main_menubar_edit_on_cut( GtkAction *gtk_action, NactMainWindow *window )
}
/**
- * nact_main_menubar_edit_on_copy:
+ * nact_menubar_edit_on_copy:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -241,12 +240,14 @@ nact_main_menubar_edit_on_cut( GtkAction *gtk_action, NactMainWindow *window )
* - (menu) refresh actions sensitivy (as selection doesn't change)
*/
void
-nact_main_menubar_edit_on_copy( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_copy( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_copy";
+ static const gchar *thisfn = "nact_menubar_edit_on_copy";
GList *items;
NactClipboard *clipboard;
+ BAR_WINDOW_VOID( window );
+
g_debug( "%s: gtk_action=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
g_return_if_fail( GTK_IS_ACTION( gtk_action ));
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
@@ -257,11 +258,11 @@ nact_main_menubar_edit_on_copy( GtkAction *gtk_action, NactMainWindow *window )
update_clipboard_counters( window );
na_object_unref_selected_items( items );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
/**
- * nact_main_menubar_edit_on_paste:
+ * nact_menubar_edit_on_paste:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -277,9 +278,9 @@ nact_main_menubar_edit_on_copy( GtkAction *gtk_action, NactMainWindow *window )
* - (menu) unreffing the copy got from clipboard
*/
void
-nact_main_menubar_edit_on_paste( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_paste( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_paste";
+ static const gchar *thisfn = "nact_menubar_edit_on_paste";
GList *items;
g_debug( "%s: gtk_action=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
@@ -292,7 +293,7 @@ nact_main_menubar_edit_on_paste( GtkAction *gtk_action, NactMainWindow *window )
}
/**
- * nact_main_menubar_edit_on_paste_into:
+ * nact_menubar_edit_on_paste_into:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -308,9 +309,9 @@ nact_main_menubar_edit_on_paste( GtkAction *gtk_action, NactMainWindow *window )
* - (menu) unreffing the copy got from clipboard
*/
void
-nact_main_menubar_edit_on_paste_into( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_paste_into( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_paste_into";
+ static const gchar *thisfn = "nact_menubar_edit_on_paste_into";
GList *items;
g_debug( "%s: gtk_action=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
@@ -325,7 +326,7 @@ nact_main_menubar_edit_on_paste_into( GtkAction *gtk_action, NactMainWindow *win
static GList *
prepare_for_paste( NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_prepare_for_paste";
+ static const gchar *thisfn = "nact_menubar_edit_prepare_for_paste";
GList *items, *it;
NactClipboard *clipboard;
NAObjectAction *action;
@@ -364,7 +365,7 @@ prepare_for_paste( NactMainWindow *window )
}
/**
- * nact_main_menubar_edit_on_duplicate:
+ * nact_menubar_edit_on_duplicate:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -376,9 +377,9 @@ prepare_for_paste( NactMainWindow *window )
* items just besides the original ones...
*/
void
-nact_main_menubar_edit_on_duplicate( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_duplicate( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_duplicate";
+ static const gchar *thisfn = "nact_menubar_edit_on_duplicate";
NactApplication *application;
NAUpdater *updater;
NAObjectAction *action;
@@ -419,7 +420,7 @@ nact_main_menubar_edit_on_duplicate( GtkAction *gtk_action, NactMainWindow *wind
}
/**
- * nact_main_menubar_edit_on_delete:
+ * nact_menubar_edit_on_delete:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -436,9 +437,9 @@ nact_main_menubar_edit_on_duplicate( GtkAction *gtk_action, NactMainWindow *wind
* this branch itself be deleted
*/
void
-nact_main_menubar_edit_on_delete( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_delete( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_edit_on_delete";
+ static const gchar *thisfn = "nact_menubar_edit_on_delete";
NactApplication *application;
NAUpdater *updater;
GList *items;
@@ -565,34 +566,34 @@ update_clipboard_counters( NactMainWindow *window )
bar->private->clipboard_actions = bar->private->selected_actions;
bar->private->clipboard_profiles = bar->private->selected_profiles;
- g_debug( "nact_main_menubar_update_clipboard_counters: menus=%d, actions=%d, profiles=%d",
+ g_debug( "nact_menubar_update_clipboard_counters: menus=%d, actions=%d, profiles=%d",
bar->private->clipboard_menus, bar->private->clipboard_actions, bar->private->clipboard_profiles );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
/**
- * nact_main_menubar_edit_on_reload:
+ * nact_menubar_edit_on_reload:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Reload items from I/O storage subsystems.
*/
void
-nact_main_menubar_edit_on_reload( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_reload( GtkAction *gtk_action, NactMainWindow *window )
{
nact_main_window_reload( window );
}
/**
- * nact_main_menubar_edit_on_preferences:
+ * nact_menubar_edit_on_preferences:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Edit preferences.
*/
void
-nact_main_menubar_edit_on_prefererences( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_edit_on_prefererences( GtkAction *gtk_action, NactMainWindow *window )
{
nact_preferences_editor_run( BASE_WINDOW( window ));
}
diff --git a/src/nact/nact-main-menubar-file.c b/src/nact/nact-menubar-file.c
similarity index 89%
rename from src/nact/nact-main-menubar-file.c
rename to src/nact/nact-menubar-file.c
index 18b999a..a0a7242 100644
--- a/src/nact/nact-main-menubar-file.c
+++ b/src/nact/nact-menubar-file.c
@@ -45,7 +45,6 @@
#include "nact-iactions-list.h"
#include "nact-main-statusbar.h"
#include "nact-main-tab.h"
-#include "nact-main-menubar-file.h"
#include "nact-menubar-priv.h"
static NATimeout st_autosave_prefs_timeout = { 0 };
@@ -63,7 +62,7 @@ static gboolean autosave_callback( NactMainWindow *window );
static void autosave_destroyed( NactMainWindow *window );
/**
- * nact_main_menubar_file_on_update_sensitivities:
+ * nact_menubar_file_on_update_sensitivities:
* @window: the #NactMainWindow main window.
* user_data: the data passed to the function via the signal.
* @mis: the #MenubarIndicatorsStruct struct.
@@ -71,9 +70,9 @@ static void autosave_destroyed( NactMainWindow *window );
* Update sensitivity of items of the File menu.
*/
void
-nact_main_menubar_file_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_file_on_update_sensitivities( const NactMenubar *bar )
{
- static const gchar *thisfn = "nact_main_menubar_file_on_update_sensitivities";
+ static const gchar *thisfn = "nact_menubar_file_on_update_sensitivities";
gboolean new_item_enabled;
gboolean has_modified_items;
@@ -106,14 +105,14 @@ nact_main_menubar_file_on_update_sensitivities( NactMenubar *bar )
}
/**
- * nact_main_menubar_file_on_new_menu:
+ * nact_menubar_file_on_new_menu:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers File / New menu item.
*/
void
-nact_main_menubar_file_on_new_menu( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_file_on_new_menu( GtkAction *gtk_action, NactMainWindow *window )
{
NAObjectMenu *menu;
GList *items;
@@ -129,14 +128,14 @@ nact_main_menubar_file_on_new_menu( GtkAction *gtk_action, NactMainWindow *windo
}
/**
- * nact_main_menubar_file_on_new_action:
+ * nact_menubar_file_on_new_action:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers File / New action item.
*/
void
-nact_main_menubar_file_on_new_action( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_file_on_new_action( GtkAction *gtk_action, NactMainWindow *window )
{
NAObjectAction *action;
GList *items;
@@ -152,14 +151,14 @@ nact_main_menubar_file_on_new_action( GtkAction *gtk_action, NactMainWindow *win
}
/**
- * nact_main_menubar_file_on_new_profile:
+ * nact_menubar_file_on_new_profile:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers File / New profile item.
*/
void
-nact_main_menubar_file_on_new_profile( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_file_on_new_profile( GtkAction *gtk_action, NactMainWindow *window )
{
NAObjectAction *action;
NAObjectProfile *profile;
@@ -191,7 +190,7 @@ nact_main_menubar_file_on_new_profile( GtkAction *gtk_action, NactMainWindow *wi
}
/**
- * nact_main_menubar_file_on_save:
+ * nact_menubar_file_on_save:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
@@ -200,28 +199,28 @@ nact_main_menubar_file_on_new_profile( GtkAction *gtk_action, NactMainWindow *wi
* Saving is not only saving modified items, but also saving hierarchy
* (and order if alpha order is not set).
*
- * This is the same function that nact_main_menubar_file_save_items(), just with
+ * This is the same function that nact_menubar_file_save_items(), just with
* different arguments.
*/
void
-nact_main_menubar_file_on_save( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_file_on_save( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_file_on_save";
+ static const gchar *thisfn = "nact_menubar_file_on_save";
g_debug( "%s: gtk_action=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
g_return_if_fail( GTK_IS_ACTION( gtk_action ));
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
- nact_main_menubar_file_save_items( window );
+ nact_menubar_file_save_items( window );
}
/**
- * nact_main_menubar_file_save_items:
+ * nact_menubar_file_save_items:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Save items.
- * This is the same function that nact_main_menubar_file_on_save(), just
+ * This is the same function that nact_menubar_file_on_save(), just
* with different arguments.
*
* Synopsis:
@@ -246,9 +245,9 @@ nact_main_menubar_file_on_save( GtkAction *gtk_action, NactMainWindow *window )
* - idem if some items cannot be actually rewritten...
*/
void
-nact_main_menubar_file_save_items( NactMainWindow *window )
+nact_menubar_file_save_items( NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_file_save_items";
+ static const gchar *thisfn = "nact_menubar_file_save_items";
GList *items, *it;
NactApplication *application;
NAUpdater *updater;
@@ -338,7 +337,7 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
* sensibilities on check status - so force it there
*/
if( !new_pivot ){
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
}
@@ -415,16 +414,16 @@ save_item( NactMainWindow *window, NAUpdater *updater, NAObjectItem *item, GSLis
}
/**
- * nact_main_menubar_file_on_quit:
+ * nact_menubar_file_on_quit:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers the File / Quit item.
*/
void
-nact_main_menubar_file_on_quit( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_file_on_quit( GtkAction *gtk_action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_file_on_quit";
+ static const gchar *thisfn = "nact_menubar_file_on_quit";
g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
g_return_if_fail( GTK_IS_ACTION( gtk_action ) || gtk_action == NULL );
@@ -433,13 +432,13 @@ nact_main_menubar_file_on_quit( GtkAction *gtk_action, NactMainWindow *window )
}
/**
- * nact_main_menubar_file_install_autosave:
+ * nact_menubar_file_install_autosave:
* @window: the #NactMainWindow main window.
*
* Setup the autosave feature and initialize its monitoring.
*/
void
-nact_main_menubar_file_install_autosave( NactMainWindow *window )
+nact_menubar_file_install_autosave( NactMainWindow *window )
{
NactApplication *application;
NAUpdater *updater;
@@ -470,7 +469,7 @@ on_autosave_prefs_changed( const gchar *group, const gchar *key, gconstpointer n
static void
on_autosave_prefs_timeout( NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_file_on_autosave_prefs_timeout";
+ static const gchar *thisfn = "nact_menubar_file_on_autosave_prefs_timeout";
NactApplication *application;
NAUpdater *updater;
NASettings *settings;
@@ -507,10 +506,10 @@ static gboolean
autosave_callback( NactMainWindow *window )
{
const gchar *context = "autosave-context";
- g_debug( "nact_main_menubar_file_autosave_callback" );
+ g_debug( "nact_menubar_file_autosave_callback" );
nact_main_statusbar_display_status( window, context, _( "Automatically saving pending modifications..." ));
- nact_main_menubar_file_save_items( window );
+ nact_menubar_file_save_items( window );
nact_main_statusbar_hide_status( window, context );
return( TRUE );
@@ -519,5 +518,5 @@ autosave_callback( NactMainWindow *window )
static void
autosave_destroyed( NactMainWindow *window )
{
- g_debug( "nact_main_menubar_file_autosave_destroyed" );
+ g_debug( "nact_menubar_file_autosave_destroyed" );
}
diff --git a/src/nact/nact-main-menubar-help.c b/src/nact/nact-menubar-help.c
similarity index 82%
rename from src/nact/nact-main-menubar-help.c
rename to src/nact/nact-menubar-help.c
index 906ba9e..074e97d 100644
--- a/src/nact/nact-main-menubar-help.c
+++ b/src/nact/nact-menubar-help.c
@@ -34,11 +34,10 @@
#include <core/na-iabout.h>
-#include "nact-main-menubar-help.h"
#include "nact-menubar-priv.h"
/**
- * nact_main_menubar_help_on_update_sensitivities:
+ * nact_menubar_help_on_update_sensitivities:
* @window: the #NactMainWindow main application window.
* @user_data: user data ?
* @mis: the #MenubarIndicatorsStruct structure.
@@ -46,23 +45,23 @@
* Update sensitivities on the Help menu.
*/
void
-nact_main_menubar_help_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_help_on_update_sensitivities( const NactMenubar *bar )
{
nact_menubar_enable_item( bar, "HelpItem", TRUE );
/* about always enabled */
}
/**
- * nact_main_menubar_help_on_help:
+ * nact_menubar_help_on_help:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Help/Help" item.
*/
void
-nact_main_menubar_help_on_help( GtkAction *action, NactMainWindow *window )
+nact_menubar_help_on_help( GtkAction *action, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_help_on_help";
+ static const gchar *thisfn = "nact_menubar_help_on_help";
GError *error;
error = NULL;
@@ -74,14 +73,14 @@ nact_main_menubar_help_on_help( GtkAction *action, NactMainWindow *window )
}
/**
- * nact_main_menubar_help_on_about:
+ * nact_menubar_help_on_about:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Help/About" item.
*/
void
-nact_main_menubar_help_on_about( GtkAction *action, NactMainWindow *window )
+nact_menubar_help_on_about( GtkAction *action, NactMainWindow *window )
{
na_iabout_display( NA_IABOUT( window ));
}
diff --git a/src/nact/nact-main-menubar-maintainer.c b/src/nact/nact-menubar-maintainer.c
similarity index 78%
rename from src/nact/nact-main-menubar-maintainer.c
rename to src/nact/nact-menubar-maintainer.c
index 1b0eeaa..abe68f5 100644
--- a/src/nact/nact-main-menubar-maintainer.c
+++ b/src/nact/nact-menubar-maintainer.c
@@ -36,10 +36,10 @@
#include "nact-iactions-list.h"
#include "nact-clipboard.h"
-#include "nact-main-menubar-maintainer.h"
+#include "nact-menubar-priv.h"
/**
- * nact_main_menubar_maintainer_on_update_sensitivities:
+ * nact_menubar_maintainer_on_update_sensitivities:
* @window: the #NactMainWindow main application window.
* @user_data: user data ?
* @mis: the #MenubarIndicatorsStruct structure.
@@ -47,19 +47,19 @@
* Update sensitivities on the Maintainer menu.
*/
void
-nact_main_menubar_maintainer_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_maintainer_on_update_sensitivities( const NactMenubar *bar )
{
}
/**
- * nact_main_menubar_maintainer_on_dump_selection:
+ * nact_menubar_maintainer_on_dump_selection:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Maintainer/Dump selection" item.
*/
void
-nact_main_menubar_maintainer_on_dump_selection( GtkAction *action, NactMainWindow *window )
+nact_menubar_maintainer_on_dump_selection( GtkAction *action, NactMainWindow *window )
{
GList *items, *it;
@@ -72,40 +72,40 @@ nact_main_menubar_maintainer_on_dump_selection( GtkAction *action, NactMainWindo
}
/**
- * nact_main_menubar_maintainer_on_brief_tree_store_dump:
+ * nact_menubar_maintainer_on_brief_tree_store_dump:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Maintainer/Brief treestore dump" item.
*/
void
-nact_main_menubar_maintainer_on_brief_tree_store_dump( GtkAction *action, NactMainWindow *window )
+nact_menubar_maintainer_on_brief_tree_store_dump( GtkAction *action, NactMainWindow *window )
{
nact_iactions_list_brief_tree_dump( NACT_IACTIONS_LIST( window ));
}
/**
- * nact_main_menubar_maintainer_on_list_modified_items:
+ * nact_menubar_maintainer_on_list_modified_items:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Maintainer/List modified items" item.
*/
void
-nact_main_menubar_maintainer_on_list_modified_items( GtkAction *action, NactMainWindow *window )
+nact_menubar_maintainer_on_list_modified_items( GtkAction *action, NactMainWindow *window )
{
nact_iactions_list_bis_list_modified_items( NACT_IACTIONS_LIST( window ));
}
/**
- * nact_main_menubar_maintainer_on_dump_clipboard:
+ * nact_menubar_maintainer_on_dump_clipboard:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Maintainer/Dump clipboard" item.
*/
void
-nact_main_menubar_maintainer_on_dump_clipboard( GtkAction *action, NactMainWindow *window )
+nact_menubar_maintainer_on_dump_clipboard( GtkAction *action, NactMainWindow *window )
{
nact_clipboard_dump( nact_main_window_get_clipboard( window ));
}
diff --git a/src/nact/nact-menubar-priv.h b/src/nact/nact-menubar-priv.h
index 2c3acee..54f8ec8 100644
--- a/src/nact/nact-menubar-priv.h
+++ b/src/nact/nact-menubar-priv.h
@@ -28,8 +28,8 @@
* ... and many others (see AUTHORS)
*/
-#ifndef __NACT_MENUBAR__PRIV_H__
-#define __NACT_MENUBAR__PRIV_H__
+#ifndef __NACT_MENUBAR_PRIV_H__
+#define __NACT_MENUBAR_PRIV_H__
/*
* SECTION: nact-menubar-priv
@@ -42,7 +42,7 @@
#include <core/na-updater.h>
-#include "base-window.h"
+#include "nact-menubar.h"
G_BEGIN_DECLS
@@ -65,6 +65,7 @@ struct _NactMenubarPrivate {
/* set when the selection changes
*/
guint count_selected;
+ GList *selected_items;
gboolean is_parent_writable; /* new menu/new action/paste menu or action */
gboolean enable_new_profile; /* new profile/paste a profile */
gboolean is_action_writable;
@@ -85,8 +86,6 @@ struct _NactMenubarPrivate {
gboolean treeview_has_focus;
gboolean level_zero_order_changed;
gulong popup_handler;
-
- GList *selected_items;
/* *** */
};
@@ -112,6 +111,54 @@ struct _NactMenubarPrivate {
*/
void nact_menubar_enable_item( const NactMenubar *bar, const gchar *name, gboolean enabled );
+void nact_menubar_edit_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_edit_on_cut ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_copy ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_paste ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_paste_into ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_duplicate ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_delete ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_reload ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_edit_on_prefererences( GtkAction *action, NactMainWindow *window );
+
+void nact_menubar_file_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_file_on_new_menu ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_file_on_new_action ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_file_on_new_profile( GtkAction *action, NactMainWindow *window );
+void nact_menubar_file_on_save ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_file_on_quit ( GtkAction *action, NactMainWindow *window );
+
+void nact_menubar_file_save_items ( NactMainWindow *window );
+void nact_menubar_file_install_autosave( NactMainWindow *window );
+
+void nact_menubar_help_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_help_on_help ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_help_on_about( GtkAction *action, NactMainWindow *window );
+
+void nact_menubar_maintainer_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_maintainer_on_dump_selection ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_maintainer_on_brief_tree_store_dump( GtkAction *action, NactMainWindow *window );
+void nact_menubar_maintainer_on_list_modified_items ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_maintainer_on_dump_clipboard ( GtkAction *action, NactMainWindow *window );
+
+void nact_menubar_tools_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_tools_on_import( GtkAction *action, NactMainWindow *window );
+void nact_menubar_tools_on_export( GtkAction *action, NactMainWindow *window );
+
+void nact_menubar_view_on_update_sensitivities( const NactMenubar *bar );
+
+void nact_menubar_view_on_expand_all ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_view_on_collapse_all ( GtkAction *action, NactMainWindow *window );
+void nact_menubar_view_on_toolbar_file ( GtkToggleAction *action, NactMainWindow *window );
+void nact_menubar_view_on_toolbar_edit ( GtkToggleAction *action, NactMainWindow *window );
+void nact_menubar_view_on_toolbar_tools( GtkToggleAction *action, NactMainWindow *window );
+void nact_menubar_view_on_toolbar_help ( GtkToggleAction *action, NactMainWindow *window );
+
G_END_DECLS
-#endif /* __NACT_MENUBAR__PRIV_H__ */
+#endif /* __NACT_MENUBAR_PRIV_H__ */
diff --git a/src/nact/nact-main-menubar-tools.c b/src/nact/nact-menubar-tools.c
similarity index 85%
rename from src/nact/nact-main-menubar-tools.c
rename to src/nact/nact-menubar-tools.c
index ff061bf..90e5123 100644
--- a/src/nact/nact-main-menubar-tools.c
+++ b/src/nact/nact-menubar-tools.c
@@ -34,11 +34,10 @@
#include "nact-assistant-export.h"
#include "nact-assistant-import.h"
-#include "nact-main-menubar-tools.h"
#include "nact-menubar-priv.h"
/**
- * nact_main_menubar_tools_on_update_sensitivities:
+ * nact_menubar_tools_on_update_sensitivities:
* @window: the #NactMainWindow main application window.
* @user_data: user data ?
* @mis: the #MenubarIndicatorsStruct structure.
@@ -46,7 +45,7 @@
* Update sensitivities on the Tools menu.
*/
void
-nact_main_menubar_tools_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_tools_on_update_sensitivities( const NactMenubar *bar )
{
/* import item enabled if at least one writable provider */
nact_menubar_enable_item( bar, "ImportItem", bar->private->has_writable_providers );
@@ -56,27 +55,27 @@ nact_main_menubar_tools_on_update_sensitivities( NactMenubar *bar )
}
/**
- * nact_main_menubar_tools_on_import:
+ * nact_menubar_tools_on_import:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Tools/Import assitant" item.
*/
void
-nact_main_menubar_tools_on_import( GtkAction *action, NactMainWindow *window )
+nact_menubar_tools_on_import( GtkAction *action, NactMainWindow *window )
{
nact_assistant_import_run( BASE_WINDOW( window ));
}
/**
- * nact_main_menubar_tools_on_export:
+ * nact_menubar_tools_on_export:
* @action: the #GtkAction of the item.
* @window: the #NactMainWindow main application window.
*
* Triggers the "Tools/Export assistant" item.
*/
void
-nact_main_menubar_tools_on_export( GtkAction *action, NactMainWindow *window )
+nact_menubar_tools_on_export( GtkAction *action, NactMainWindow *window )
{
nact_assistant_export_run( BASE_WINDOW( window ));
}
diff --git a/src/nact/nact-main-menubar-view.c b/src/nact/nact-menubar-view.c
similarity index 81%
rename from src/nact/nact-main-menubar-view.c
rename to src/nact/nact-menubar-view.c
index 7a142ae..b8f63f1 100644
--- a/src/nact/nact-main-menubar-view.c
+++ b/src/nact/nact-menubar-view.c
@@ -34,13 +34,12 @@
#include "nact-iactions-list.h"
#include "nact-main-toolbar.h"
-#include "nact-main-menubar-view.h"
#include "nact-menubar-priv.h"
static void on_view_toolbar_activated( GtkToggleAction *action, NactMainWindow *window, int toolbar_id );
/**
- * nact_main_menubar_view_on_update_sensitivities:
+ * nact_menubar_view_on_update_sensitivities:
* @window: the #NactMainWindow main window.
* user_data: the data passed to the function via the signal.
* @mis: the #MenubarIndicatorsStruct struct.
@@ -48,7 +47,7 @@ static void on_view_toolbar_activated( GtkToggleAction *action, NactMainWindow *
* Update sensitivity of items of the View menu.
*/
void
-nact_main_menubar_view_on_update_sensitivities( NactMenubar *bar )
+nact_menubar_view_on_update_sensitivities( const NactMenubar *bar )
{
guint count_list;
@@ -59,82 +58,82 @@ nact_main_menubar_view_on_update_sensitivities( NactMenubar *bar )
}
/**
- * nact_main_menubar_view_on_expand_all:
+ * nact_menubar_view_on_expand_all:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Expand all item.
*/
void
-nact_main_menubar_view_on_expand_all( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_view_on_expand_all( GtkAction *gtk_action, NactMainWindow *window )
{
nact_iactions_list_expand_all( NACT_IACTIONS_LIST( window ));
}
/**
- * nact_main_menubar_view_on_collapse_all:
+ * nact_menubar_view_on_collapse_all:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Collapse all item.
*/
void
-nact_main_menubar_view_on_collapse_all( GtkAction *gtk_action, NactMainWindow *window )
+nact_menubar_view_on_collapse_all( GtkAction *gtk_action, NactMainWindow *window )
{
nact_iactions_list_collapse_all( NACT_IACTIONS_LIST( window ));
}
/**
- * nact_main_menubar_view_on_toolbar_file:
+ * nact_menubar_view_on_toolbar_file:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Toolbar / File item.
*/
void
-nact_main_menubar_view_on_toolbar_file( GtkToggleAction *action, NactMainWindow *window )
+nact_menubar_view_on_toolbar_file( GtkToggleAction *action, NactMainWindow *window )
{
/*on_view_toolbar_activated( action, window, MENUBAR_IPREFS_FILE_TOOLBAR, "/ui/FileToolbar", MENUBAR_FILE_TOOLBAR_POS );*/
on_view_toolbar_activated( action, window, MAIN_TOOLBAR_FILE_ID );
}
/**
- * nact_main_menubar_view_on_toolbar_edit:
+ * nact_menubar_view_on_toolbar_edit:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Toolbar / Edit item.
*/
void
-nact_main_menubar_view_on_toolbar_edit( GtkToggleAction *action, NactMainWindow *window )
+nact_menubar_view_on_toolbar_edit( GtkToggleAction *action, NactMainWindow *window )
{
/*on_view_toolbar_activated( action, window, MENUBAR_IPREFS_EDIT_TOOLBAR, "/ui/EditToolbar", MENUBAR_EDIT_TOOLBAR_POS );*/
on_view_toolbar_activated( action, window, MAIN_TOOLBAR_EDIT_ID );
}
/**
- * nact_main_menubar_view_on_toolbar_tools:
+ * nact_menubar_view_on_toolbar_tools:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Toolbar / Tools item.
*/
void
-nact_main_menubar_view_on_toolbar_tools( GtkToggleAction *action, NactMainWindow *window )
+nact_menubar_view_on_toolbar_tools( GtkToggleAction *action, NactMainWindow *window )
{
/*on_view_toolbar_activated( action, window, MENUBAR_IPREFS_TOOLS_TOOLBAR, "/ui/ToolsToolbar", MENUBAR_TOOLS_TOOLBAR_POS );*/
on_view_toolbar_activated( action, window, MAIN_TOOLBAR_TOOLS_ID );
}
/**
- * nact_main_menubar_view_on_toolbar_help:
+ * nact_menubar_view_on_toolbar_help:
* @gtk_action: the #GtkAction action.
* @window: the #NactMainWindow main window.
*
* Triggers View / Toolbar / Help item.
*/
void
-nact_main_menubar_view_on_toolbar_help( GtkToggleAction *action, NactMainWindow *window )
+nact_menubar_view_on_toolbar_help( GtkToggleAction *action, NactMainWindow *window )
{
/*on_view_toolbar_activated( action, window, MENUBAR_IPREFS_HELP_TOOLBAR, "/ui/HelpToolbar", MENUBAR_HELP_TOOLBAR_POS );*/
on_view_toolbar_activated( action, window, MAIN_TOOLBAR_HELP_ID );
diff --git a/src/nact/nact-menubar.c b/src/nact/nact-menubar.c
index f94f348..8b2f66b 100644
--- a/src/nact/nact-menubar.c
+++ b/src/nact/nact-menubar.c
@@ -37,7 +37,6 @@
#include <api/na-object-api.h>
#include "nact-application.h"
-#include "nact-menubar.h"
#include "nact-menubar-priv.h"
/* *** */
@@ -52,13 +51,6 @@
#include "nact-main-statusbar.h"
#include "nact-main-toolbar.h"
#include "nact-main-tab.h"
-#include "nact-main-menubar-file.h"
-#include "nact-main-menubar-edit.h"
-#include "nact-main-menubar-view.h"
-#include "nact-main-menubar-tools.h"
-#include "nact-main-menubar-maintainer.h"
-#include "nact-main-menubar-help.h"
-#include "nact-menubar.h"
#include "nact-sort-buttons.h"
/* *** */
@@ -85,98 +77,98 @@ static const GtkActionEntry entries[] = {
{ "NewMenuItem", NULL, N_( "New _menu" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'New menu' item */
N_( "Insert a new menu at the current position" ),
- G_CALLBACK( nact_main_menubar_file_on_new_menu ) },
+ G_CALLBACK( nact_menubar_file_on_new_menu ) },
{ "NewActionItem", GTK_STOCK_NEW, N_( "_New action" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'New action' item */
N_( "Define a new action" ),
- G_CALLBACK( nact_main_menubar_file_on_new_action ) },
+ G_CALLBACK( nact_menubar_file_on_new_action ) },
{ "NewProfileItem", NULL, N_( "New _profile" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'New profile' item */
N_( "Define a new profile attached to the current action" ),
- G_CALLBACK( nact_main_menubar_file_on_new_profile ) },
+ G_CALLBACK( nact_menubar_file_on_new_profile ) },
{ "SaveItem", GTK_STOCK_SAVE, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting 'Save' item */
N_( "Record all the modified actions. Invalid actions will be silently ignored" ),
- G_CALLBACK( nact_main_menubar_file_on_save ) },
+ G_CALLBACK( nact_menubar_file_on_save ) },
{ "QuitItem", GTK_STOCK_QUIT, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting 'Quit' item */
N_( "Quit the application" ),
- G_CALLBACK( nact_main_menubar_file_on_quit ) },
+ G_CALLBACK( nact_menubar_file_on_quit ) },
{ "CutItem" , GTK_STOCK_CUT, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting the Cut item */
N_( "Cut the selected item(s) to the clipboard" ),
- G_CALLBACK( nact_main_menubar_edit_on_cut ) },
+ G_CALLBACK( nact_menubar_edit_on_cut ) },
{ "CopyItem" , GTK_STOCK_COPY, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting the Copy item */
N_( "Copy the selected item(s) to the clipboard" ),
- G_CALLBACK( nact_main_menubar_edit_on_copy ) },
+ G_CALLBACK( nact_menubar_edit_on_copy ) },
{ "PasteItem" , GTK_STOCK_PASTE, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting the Paste item */
N_( "Insert the content of the clipboard just before the current position" ),
- G_CALLBACK( nact_main_menubar_edit_on_paste ) },
+ G_CALLBACK( nact_menubar_edit_on_paste ) },
{ "PasteIntoItem" , NULL, N_( "Paste _into" ), "<Shift><Ctrl>V",
/* i18n: tooltip displayed in the status bar when selecting the Paste Into item */
N_( "Insert the content of the clipboard as first child of the current item" ),
- G_CALLBACK( nact_main_menubar_edit_on_paste_into ) },
+ G_CALLBACK( nact_menubar_edit_on_paste_into ) },
{ "DuplicateItem" , NULL, N_( "D_uplicate" ), "",
/* i18n: tooltip displayed in the status bar when selecting the Duplicate item */
N_( "Duplicate the selected item(s)" ),
- G_CALLBACK( nact_main_menubar_edit_on_duplicate ) },
+ G_CALLBACK( nact_menubar_edit_on_duplicate ) },
{ "DeleteItem", GTK_STOCK_DELETE, NULL, "Delete",
/* i18n: tooltip displayed in the status bar when selecting the Delete item */
N_( "Delete the selected item(s)" ),
- G_CALLBACK( nact_main_menubar_edit_on_delete ) },
+ G_CALLBACK( nact_menubar_edit_on_delete ) },
{ "ReloadActionsItem", GTK_STOCK_REFRESH, N_( "_Reload the items" ), "F5",
/* i18n: tooltip displayed in the status bar when selecting the 'Reload' item */
N_( "Cancel your current modifications and reload the initial list of menus and actions" ),
- G_CALLBACK( nact_main_menubar_edit_on_reload ) },
+ G_CALLBACK( nact_menubar_edit_on_reload ) },
{ "PreferencesItem", GTK_STOCK_PREFERENCES, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'Preferences' item */
N_( "Edit your preferences" ),
- G_CALLBACK( nact_main_menubar_edit_on_prefererences ) },
+ G_CALLBACK( nact_menubar_edit_on_prefererences ) },
{ "ExpandAllItem" , NULL, N_( "_Expand all" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the Expand all item */
N_( "Entirely expand the items hierarchy" ),
- G_CALLBACK( nact_main_menubar_view_on_expand_all ) },
+ G_CALLBACK( nact_menubar_view_on_expand_all ) },
{ "CollapseAllItem" , NULL, N_( "_Collapse all" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the Collapse all item */
N_( "Entirely collapse the items hierarchy" ),
- G_CALLBACK( nact_main_menubar_view_on_collapse_all ) },
+ G_CALLBACK( nact_menubar_view_on_collapse_all ) },
{ "ImportItem" , GTK_STOCK_CONVERT, N_( "_Import assistant..." ), "",
/* i18n: tooltip displayed in the status bar when selecting the Import item */
N_( "Import one or more actions from external (XML) files into your configuration" ),
- G_CALLBACK( nact_main_menubar_tools_on_import ) },
+ G_CALLBACK( nact_menubar_tools_on_import ) },
{ "ExportItem", NULL, N_( "E_xport assistant..." ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the Export item */
N_( "Export one or more actions from your configuration to external XML files" ),
- G_CALLBACK( nact_main_menubar_tools_on_export ) },
+ G_CALLBACK( nact_menubar_tools_on_export ) },
{ "DumpSelectionItem", NULL, N_( "_Dump the selection" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the Dump selection item */
N_( "Recursively dump selected items" ),
- G_CALLBACK( nact_main_menubar_maintainer_on_dump_selection ) },
+ G_CALLBACK( nact_menubar_maintainer_on_dump_selection ) },
{ "BriefTreeStoreDumpItem", NULL, N_( "_Brief tree store dump" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the BriefTreeStoreDump item */
N_( "Briefly dump the tree store" ),
- G_CALLBACK( nact_main_menubar_maintainer_on_brief_tree_store_dump ) },
+ G_CALLBACK( nact_menubar_maintainer_on_brief_tree_store_dump ) },
{ "ListModifiedItems", NULL, N_( "_List modified items" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the ListModifiedItems item */
N_( "List the modified items" ),
- G_CALLBACK( nact_main_menubar_maintainer_on_list_modified_items ) },
+ G_CALLBACK( nact_menubar_maintainer_on_list_modified_items ) },
{ "DumpClipboard", NULL, N_( "_Dump the clipboard" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the DumpClipboard item */
N_( "Dump the content of the clipboard object" ),
- G_CALLBACK( nact_main_menubar_maintainer_on_dump_clipboard ) },
+ G_CALLBACK( nact_menubar_maintainer_on_dump_clipboard ) },
{ "HelpItem" , GTK_STOCK_HELP, N_( "Contents" ), "F1",
/* i18n: tooltip displayed in the status bar when selecting the Help item */
N_( "Display help about this program" ),
- G_CALLBACK( nact_main_menubar_help_on_help ) },
+ G_CALLBACK( nact_menubar_help_on_help ) },
{ "AboutItem", GTK_STOCK_ABOUT, NULL, NULL,
/* i18n: tooltip displayed in the status bar when selecting the About item */
N_( "Display informations about this program" ),
- G_CALLBACK( nact_main_menubar_help_on_about ) },
+ G_CALLBACK( nact_menubar_help_on_about ) },
};
static const GtkToggleActionEntry toolbar_entries[] = {
@@ -184,19 +176,19 @@ static const GtkToggleActionEntry toolbar_entries[] = {
{ "ViewFileToolbarItem", NULL, N_( "_File" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'View File toolbar' item */
N_( "Display the File toolbar" ),
- G_CALLBACK( nact_main_menubar_view_on_toolbar_file ), FALSE },
+ G_CALLBACK( nact_menubar_view_on_toolbar_file ), FALSE },
{ "ViewEditToolbarItem", NULL, N_( "_Edit" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting the 'View Edit toolbar' item */
N_( "Display the Edit toolbar" ),
- G_CALLBACK( nact_main_menubar_view_on_toolbar_edit ), FALSE },
+ G_CALLBACK( nact_menubar_view_on_toolbar_edit ), FALSE },
{ "ViewToolsToolbarItem", NULL, N_( "_Tools" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting 'View Tools toolbar' item */
N_( "Display the Tools toolbar" ),
- G_CALLBACK( nact_main_menubar_view_on_toolbar_tools ), FALSE },
+ G_CALLBACK( nact_menubar_view_on_toolbar_tools ), FALSE },
{ "ViewHelpToolbarItem", NULL, N_( "_Help" ), NULL,
/* i18n: tooltip displayed in the status bar when selecting 'View Help toolbar' item */
N_( "Display the Help toolbar" ),
- G_CALLBACK( nact_main_menubar_view_on_toolbar_help ), FALSE },
+ G_CALLBACK( nact_menubar_view_on_toolbar_help ), FALSE },
};
/* GtkActivatable
@@ -247,7 +239,7 @@ static void on_iactions_list_focus_in( NactMainWindow *window, gpointer user
static void on_iactions_list_focus_out( NactMainWindow *window, gpointer user_data );
static void on_iactions_list_status_changed( NactMainWindow *window, gpointer user_data );
static void on_level_zero_order_changed( NactMainWindow *window, gpointer user_data );
-static void on_update_sensitivities( NactMainWindow *window, gpointer user_data );
+static void on_update_sensitivities( NactMenubar *bar, NactMainWindow *window );
static void on_popup_selection_done(GtkMenuShell *menushell, NactMainWindow *window );
@@ -524,10 +516,10 @@ on_base_initialize_window( BaseWindow *window, gpointer user_data )
G_OBJECT( window ), IACTIONS_LIST_SIGNAL_STATUS_CHANGED, G_CALLBACK( on_iactions_list_status_changed ));
base_window_signal_connect( window,
- G_OBJECT( window ), MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, G_CALLBACK( on_update_sensitivities ));
+ G_OBJECT( window ), MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED, G_CALLBACK( on_level_zero_order_changed ));
base_window_signal_connect( window,
- G_OBJECT( window ), MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED, G_CALLBACK( on_level_zero_order_changed ));
+ G_OBJECT( bar ), MENUBAR_SIGNAL_UPDATE_SENSITIVITIES, G_CALLBACK( on_update_sensitivities ));
nact_main_toolbar_init(( NactMainWindow * ) window, bar->private->action_group );
}
@@ -573,7 +565,7 @@ on_menu_item_selected( GtkMenuItem *proxy, NactMainWindow *window )
GtkAction *action;
gchar *tooltip;
- /*g_debug( "nact_main_menubar_on_menu_item_selected: proxy=%p (%s), window=%p (%s)",
+ /*g_debug( "nact_menubar_on_menu_item_selected: proxy=%p (%s), window=%p (%s)",
( void * ) proxy, G_OBJECT_TYPE_NAME( proxy ),
( void * ) window, G_OBJECT_TYPE_NAME( window ));*/
@@ -606,6 +598,39 @@ on_menu_item_deselected( GtkMenuItem *proxy, NactMainWindow *window )
nact_main_statusbar_hide_status( window, MENUBAR_PROP_STATUS_CONTEXT );
}
+/**
+ * nact_menubar_open_popup:
+ * @window: this #NactMainWindow window.
+ * @event: the mouse event.
+ *
+ * Opens a popup menu.
+ */
+void
+nact_menubar_open_popup( BaseWindow *window, GdkEventButton *event )
+{
+ GtkWidget *menu;
+
+ BAR_WINDOW_VOID( window );
+
+ menu = gtk_ui_manager_get_widget( bar->private->ui_manager, "/ui/Popup" );
+ bar->private->popup_handler =
+ g_signal_connect( menu, "selection-done", G_CALLBACK( on_popup_selection_done ), window );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
+ gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, event->button, event->time );
+}
+
+/**
+ * nact_menubar_save_items:
+ * @window: the #NactMainWindow
+ */
+void
+nact_menubar_save_items( BaseWindow *window )
+{
+ g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
+
+ nact_menubar_file_save_items( NACT_MAIN_WINDOW( window ));
+}
+
/*
* triggered just before the NactMainWindow is finalized
*/
@@ -623,41 +648,18 @@ on_finalizing_window( NactMenubar *bar, GObject *window )
}
/**
- * nact_main_menubar_is_level_zero_order_changed:
+ * nact_menubar_is_level_zero_order_changed:
* @window: the #NactMainWindow main window.
*
* Returns: %TRUE if the level zero has changed, %FALSE else.
*/
gboolean
-nact_main_menubar_is_level_zero_order_changed( const NactMainWindow *window )
+nact_menubar_is_level_zero_order_changed( const NactMainWindow *window )
{
BAR_WINDOW_VALUE( window, FALSE );
return( bar->private->level_zero_order_changed );
}
-/**
- * nact_main_menubar_open_popup:
- * @window: this #NactMainWindow window.
- * @event: the mouse event.
- *
- * Opens a popup menu.
- */
-void
-nact_main_menubar_open_popup( NactMainWindow *instance, GdkEventButton *event )
-{
- GtkWidget *menu;
-
- BAR_WINDOW_VOID( instance );
-
- menu = gtk_ui_manager_get_widget( bar->private->ui_manager, "/ui/Popup" );
-
- bar->private->popup_handler = g_signal_connect( menu, "selection-done", G_CALLBACK( on_popup_selection_done ), instance );
-
- g_signal_emit_by_name( instance, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
-
- gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, event->button, event->time );
-}
-
/*
* when the IActionsList is refilled, update our internal counters so
* that we are knowing if we have some exportables
@@ -669,7 +671,7 @@ on_iactions_list_count_updated( NactMainWindow *window, gint menus, gint actions
BAR_WINDOW_VOID( window );
- g_debug( "nact_main_menubar_on_iactions_list_count_updated: menus=%u, actions=%u, profiles=%u", menus, actions, profiles );
+ g_debug( "nact_menubar_on_iactions_list_count_updated: menus=%u, actions=%u, profiles=%u", menus, actions, profiles );
bar->private->list_menus = menus;
bar->private->list_actions = actions;
@@ -683,7 +685,7 @@ on_iactions_list_count_updated( NactMainWindow *window, gint menus, gint actions
nact_main_statusbar_display_status( window, MENUBAR_PROP_MAIN_STATUS_CONTEXT, status );
g_free( status );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
/*
@@ -702,6 +704,17 @@ on_iactions_list_selection_changed( NactMainWindow *window, GList *selected )
g_debug( "%s: selected=%p (count=%d)", thisfn, ( void * ) selected, g_list_length( selected ));
bar->private->count_selected = g_list_length( selected );
+#if 0
+ if( bar->private->selected_items ){
+ bar->private->selected_items = na_object_free_items( bar->private->selected_items );
+ }
+ bar->private->selected_items = na_object_ref_items( selected );
+#else
+ if( bar->private->selected_items ){
+ na_object_unref_selected_items( bar->private->selected_items );
+ }
+ bar->private->selected_items = nact_iactions_list_bis_get_selected_items( NACT_IACTIONS_LIST( window ));
+#endif
if( selected ){
/* check if the parent of the first selected item is writable
@@ -782,10 +795,10 @@ on_iactions_list_selection_changed( NactMainWindow *window, GList *selected )
bar->private->selected_actions = 0;
bar->private->selected_profiles = 0;
na_object_item_count_items( selected, &bar->private->selected_menus, &bar->private->selected_actions, &bar->private->selected_profiles, FALSE );
- g_debug( "nact_main_menubar_on_iactions_list_selection_changed: menus=%d, actions=%d, profiles=%d",
+ g_debug( "nact_menubar_on_iactions_list_selection_changed: menus=%d, actions=%d, profiles=%d",
bar->private->selected_menus, bar->private->selected_actions, bar->private->selected_profiles );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
static void
@@ -793,10 +806,10 @@ on_iactions_list_focus_in( NactMainWindow *window, gpointer user_data )
{
BAR_WINDOW_VOID( window );
- g_debug( "nact_main_menubar_on_iactions_list_focus_in" );
+ g_debug( "nact_menubar_on_iactions_list_focus_in" );
bar->private->treeview_has_focus = TRUE;
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
static void
@@ -804,20 +817,20 @@ on_iactions_list_focus_out( NactMainWindow *window, gpointer user_data )
{
BAR_WINDOW_VOID( window );
- g_debug( "nact_main_menubar_on_iactions_list_focus_out" );
+ g_debug( "nact_menubar_on_iactions_list_focus_out" );
bar->private->treeview_has_focus = FALSE;
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
static void
on_iactions_list_status_changed( NactMainWindow *window, gpointer user_data )
{
- g_debug( "nact_main_menubar_on_iactions_list_status_changed" );
+ g_debug( "nact_menubar_on_iactions_list_status_changed" );
- g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
+ BAR_WINDOW_VOID( window );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
static void
@@ -825,34 +838,25 @@ on_level_zero_order_changed( NactMainWindow *window, gpointer user_data )
{
BAR_WINDOW_VOID( window );
- g_debug( "nact_main_menubar_on_level_zero_order_changed: change=%s", user_data ? "True":"False" );
+ g_debug( "nact_menubar_on_level_zero_order_changed: change=%s", user_data ? "True":"False" );
bar->private->level_zero_order_changed = GPOINTER_TO_INT( user_data );
- g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
+ g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
static void
-on_update_sensitivities( NactMainWindow *window, gpointer user_data )
+on_update_sensitivities( NactMenubar *bar, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_on_update_sensitivities";
+ static const gchar *thisfn = "nact_menubar_on_update_sensitivities";
- BAR_WINDOW_VOID( window );
-
- g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
+ g_debug( "%s: bar=%p, window=%p", thisfn, ( void * ) bar, ( void * ) window );
- bar->private->selected_items = nact_iactions_list_bis_get_selected_items( NACT_IACTIONS_LIST( window ));
- bar->private->count_selected = bar->private->selected_items ? g_list_length( bar->private->selected_items ) : 0;
- g_debug( "%s: count_selected=%d", thisfn, bar->private->count_selected );
-
- nact_main_menubar_file_on_update_sensitivities( bar );
- nact_main_menubar_edit_on_update_sensitivities( bar );
- nact_main_menubar_view_on_update_sensitivities( bar );
- nact_main_menubar_tools_on_update_sensitivities( bar );
- nact_main_menubar_maintainer_on_update_sensitivities( bar );
- nact_main_menubar_help_on_update_sensitivities( bar );
-
- na_object_unref_selected_items( bar->private->selected_items );
- bar->private->selected_items = NULL;
+ nact_menubar_file_on_update_sensitivities( bar );
+ nact_menubar_edit_on_update_sensitivities( bar );
+ nact_menubar_view_on_update_sensitivities( bar );
+ nact_menubar_tools_on_update_sensitivities( bar );
+ nact_menubar_maintainer_on_update_sensitivities( bar );
+ nact_menubar_help_on_update_sensitivities( bar );
}
/**
@@ -878,7 +882,7 @@ nact_menubar_enable_item( const NactMenubar *bar, const gchar *name, gboolean en
static void
on_popup_selection_done(GtkMenuShell *menushell, NactMainWindow *window )
{
- static const gchar *thisfn = "nact_main_menubar_on_popup_selection_done";
+ static const gchar *thisfn = "nact_menubar_on_popup_selection_done";
BAR_WINDOW_VOID( window );
diff --git a/src/nact/nact-menubar.h b/src/nact/nact-menubar.h
index b552772..b26f8dc 100644
--- a/src/nact/nact-menubar.h
+++ b/src/nact/nact-menubar.h
@@ -93,11 +93,13 @@ typedef struct {
GType nact_menubar_get_type( void );
-NactMenubar *nact_menubar_new ( BaseWindow *window );
+NactMenubar *nact_menubar_new ( BaseWindow *window );
+
+void nact_menubar_open_popup( BaseWindow *window, GdkEventButton *event );
+void nact_menubar_save_items( BaseWindow *window );
/* *** */
-gboolean nact_main_menubar_is_level_zero_order_changed( const NactMainWindow *window );
-void nact_main_menubar_open_popup( NactMainWindow *window, GdkEventButton *event );
+gboolean nact_menubar_is_level_zero_order_changed( const NactMainWindow *window );
/* *** */
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]