[nautilus-actions] Remove nact-iprefs.{c,h} files
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Remove nact-iprefs.{c,h} files
- Date: Wed, 19 Jan 2011 21:53:26 +0000 (UTC)
commit 86e3cf4ddc9804fd06b0650344de68012cc3aba7
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jan 14 02:32:07 2011 +0100
Remove nact-iprefs.{c,h} files
ChangeLog | 23 +++++
src/core/na-iprefs.c | 46 +++++++++
src/core/na-iprefs.h | 39 +-------
src/nact/Makefile.am | 2 -
src/nact/base-window.c | 18 ----
src/nact/nact-assistant-export.c | 17 +++-
src/nact/nact-assistant-import.c | 1 -
src/nact/nact-clipboard.c | 4 +-
src/nact/nact-export-ask.c | 26 +++--
src/nact/nact-export-format.c | 1 -
src/nact/nact-gtk-utils.c | 1 -
src/nact/nact-iaction-tab.c | 1 -
src/nact/nact-icommand-tab.c | 1 -
src/nact/nact-ifolders-tab.c | 1 -
src/nact/nact-iprefs.c | 188 ------------------------------------
src/nact/nact-iprefs.h | 68 -------------
src/nact/nact-main-toolbar.c | 1 -
src/nact/nact-preferences-editor.c | 7 +-
src/nact/nact-tree-model-dnd.c | 1 -
19 files changed, 109 insertions(+), 337 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4047cc9..4e67859 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,29 @@
* src/utils/nautilus-actions-run.c:
* src/utils/nautilus-actions-schemas.c: Add locale.h include.
+ * src/core/na-iprefs.c:
+ * src/core/na-iprefs.h
+ (na_iprefs_get_export_format, na_iprefs_set_export_format):
+ Functions moved from src/nact/nact-iprefs.c.
+
+ * src/nact/nact-iprefs.c:
+ * src/nact/nact-iprefs.h: Removed files.
+
+ * src/nact/Makefile.am:
+ * src/nact/base-window.c:
+ * src/nact/nact-assistant-export.c:
+ * src/nact/nact-assistant-import.c:
+ * src/nact/nact-clipboard.c:
+ * src/nact/nact-export-ask.c:
+ * src/nact/nact-export-format.c:
+ * src/nact/nact-gtk-utils.c:
+ * src/nact/nact-iaction-tab.c:
+ * src/nact/nact-icommand-tab.c:
+ * src/nact/nact-ifolders-tab.c:
+ * src/nact/nact-main-toolbar.c:
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-tree-model-dnd.c: Updated accordingly.
+
* src/nact/nact-iprefs.c:
* src/nact/nact-iprefs.h (nact_iprefs_write_bool, nact_iprefs_write_uint,
nact_iprefs_write_string): Remove deprecated functions.
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index 3e38109..6d3eab1 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -164,6 +164,52 @@ na_iprefs_set_order_mode( const NAPivot *pivot, guint mode )
na_settings_set_string( settings, NA_IPREFS_ITEMS_LIST_ORDER_MODE, order_str );
}
+/**
+ * na_iprefs_get_export_format:
+ * @pivot: the #NAPivot application object.
+ * @name: name of the export format key to be readen
+ *
+ * Used to default to export as a GConfEntry.
+ * Starting with 3.1.0, defaults to Desktop1 (see. core/na-settings.h)
+ *
+ * Returns: the export format currently set as a #GQuark.
+ */
+GQuark
+na_iprefs_get_export_format( const NAPivot *pivot, const gchar *name )
+{
+ GQuark export_format;
+ NASettings *settings;
+ gchar *format_str;
+
+ export_format = g_quark_from_static_string( NA_IPREFS_DEFAULT_EXPORT_FORMAT );
+
+ settings = na_pivot_get_settings( pivot );
+ format_str = na_settings_get_string( settings, name, NULL, NULL );
+
+ if( format_str ){
+ export_format = g_quark_from_string( format_str );
+ g_free( format_str );
+ }
+
+ return( export_format );
+}
+
+/**
+ * na_iprefs_set_export_format:
+ * @pivot: the #NAPivot application object.
+ * @format: the new value to be written.
+ *
+ * Writes the preferred export format' to the preference system.
+ */
+void
+na_iprefs_set_export_format( const NAPivot *pivot, const gchar *name, GQuark format )
+{
+ NASettings *settings;
+
+ settings = na_pivot_get_settings( pivot );
+ na_settings_set_string( settings, name, g_quark_to_string( format ));
+}
+
/*
* na_iprefs_get_io_providers:
* @pivot: the #NAPivot application object.
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index 44f7835..6c1772e 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -31,41 +31,9 @@
#ifndef __CORE_NA_IPREFS_H__
#define __CORE_NA_IPREFS_H__
-/* @title: NAIPrefs
- * @short_description: The #NAIPrefs Interface Definition
- * @include: core/na-iprefs.h
- *
- * This interface should only be implemented by #NAPivot. This is
- * because the interface stores as an implementor structure some data
- * which are only relevant for one client (e.g. GConfClient).
- *
- * Though all modules may use the public functions na_iprefs_xxx(),
- * only #NAPivot will receive update notifications, taking itself care
- * of proxying them to its identified #NAIPivotConsumers.
- *
- * Displaying the actions.
- *
- * - actions in alphabetical order:
- *
- * Nautilus-Actions used to display the actions in alphabetical order.
- * Starting with 1.12.x, Nautilus-Actions lets the user rearrange
- * himself the order of its actions.
- *
- * This option may have three values :
- * - ascending alphabetical order (historical behavior, and default),
- * - descending alphabetical order,
- * - manual ordering.
- *
- * - adding a 'About Nautilus-Actions' item at end of actions: yes/no
- *
- * When checked, an 'About Nautilus-Actions' is displayed as the last
- * item of the root submenu of Nautilus-Actions actions.
- *
- * It the user didn't have defined a root submenu, whether in the NACT
- * user interface or by choosing the ad-hoc preference, the plugin
- * doesn't provides one, and the 'About' item will not be displayed.
+/*
+ * Starting with 3.1.0, NAIPrefs interface is deprecated.
*
- * Starting with 3.1.0, NAIPrefs interface is deprecated in this form.
* Instead, this module is used as an intermediate level between actual
* settings and the application; it so implements all maps needed to
* transform an enum used in the code to and from a string stored in
@@ -90,6 +58,9 @@ void na_iprefs_set_import_mode ( const NAPivot *pivot, const gchar *pr
guint na_iprefs_get_order_mode ( const NAPivot *pivot );
void na_iprefs_set_order_mode ( const NAPivot *pivot, guint mode );
+GQuark na_iprefs_get_export_format ( const NAPivot *pivot, const gchar *pref );
+void na_iprefs_set_export_format ( const NAPivot *pivot, const gchar *pref, GQuark format );
+
GSList *na_iprefs_get_io_providers ( const NAPivot * );
gboolean na_iprefs_is_level_zero_writable( const NAPivot *pivot );
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index f87f29a..6cb8a4a 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -114,8 +114,6 @@ nautilus_actions_config_tool_SOURCES = \
nact-icommand-tab.h \
nact-imimetypes-tab.c \
nact-imimetypes-tab.h \
- nact-iprefs.c \
- nact-iprefs.h \
nact-iproperties-tab.c \
nact-iproperties-tab.h \
nact-ischemes-tab.c \
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index e39647b..43a58f2 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -39,7 +39,6 @@
#include "base-application.h"
#include "base-iprefs.h"
-#include "nact-iprefs.h"
#include "base-window.h"
/* private class data
@@ -101,7 +100,6 @@ static gboolean st_debug_signal_connect = FALSE;
static GType register_type( void );
static void class_init( BaseWindowClass *klass );
static void iprefs_base_iface_init( BaseIPrefsInterface *iface );
-static void iprefs_nact_iface_init( NactIPrefsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
@@ -173,20 +171,12 @@ register_type( void )
NULL
};
- static const GInterfaceInfo iprefs_nact_iface_info = {
- ( GInterfaceInitFunc ) iprefs_nact_iface_init,
- NULL,
- NULL
- };
-
g_debug( "%s", thisfn );
type = g_type_register_static( G_TYPE_OBJECT, "BaseWindow", &info, 0 );
g_type_add_interface_static( type, BASE_IPREFS_TYPE, &iprefs_base_iface_info );
- g_type_add_interface_static( type, NACT_IPREFS_TYPE, &iprefs_nact_iface_info );
-
return( type );
}
@@ -349,14 +339,6 @@ iprefs_base_iface_init( BaseIPrefsInterface *iface )
}
static void
-iprefs_nact_iface_init( NactIPrefsInterface *iface )
-{
- static const gchar *thisfn = "base_window_iprefs_nact_iface_init";
-
- g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-}
-
-static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "base_window_instance_init";
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index ffa1c90..dd1658b 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -44,7 +44,6 @@
#include "base-iprefs.h"
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-main-window.h"
#include "nact-assistant-export.h"
#include "nact-export-ask.h"
@@ -609,8 +608,13 @@ assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant
GtkWidget *content;
GtkWidget *container;
GQuark format;
+ NactApplication *application;
+ NAUpdater *updater;
+
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ updater = nact_application_get_updater( application );
+ format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
- format = nact_iprefs_get_export_format( BASE_WINDOW( window ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
container = base_window_get_widget( BASE_WINDOW( window ), "AssistantExportFormatVBox" );
nact_export_format_select( container, format );
@@ -683,10 +687,15 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
GList *items, *it;
NAExportFormat *format;
GtkLabel *confirm_label;
+ NactApplication *application;
+ NAUpdater *updater;
g_debug( "%s: window=%p, assistant=%p, page=%p",
thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ updater = nact_application_get_updater( application );
+
/* i18n: this is the title of the confirm page of the export assistant */
text = g_string_new( "" );
g_string_printf( text, "<b>%s</b>\n\n", _( "About to export selected items:" ));
@@ -710,7 +719,7 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
format = get_export_format( window );
label11 = na_export_format_get_label( format );
label21 = na_export_format_get_description( format );
- nact_iprefs_set_export_format( BASE_WINDOW( window ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( format ));
+ na_iprefs_set_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( format ));
label12 = na_core_utils_str_remove_char( label11, "_" );
label22 = na_core_utils_str_add_prefix( "\t", label21 );
g_string_append_printf( text, "\n\n<b>%s</b>\n\n%s", label12, label22 );
@@ -757,7 +766,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
str->item = NA_OBJECT_ITEM( na_object_get_origin( NA_IDUPLICABLE( ia->data )));
- str->format = nact_iprefs_get_export_format( BASE_WINDOW( wnd ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
+ str->format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
if( str->format == IPREFS_EXPORT_FORMAT_ASK ){
str->format = nact_export_ask_user( BASE_WINDOW( wnd ), str->item );
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 48bcf7f..e922b57 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -42,7 +42,6 @@
#include <core/na-iprefs.h>
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-iactions-list.h"
#include "nact-assistant-import.h"
#include "nact-main-window.h"
diff --git a/src/nact/nact-clipboard.c b/src/nact/nact-clipboard.c
index 5e85b6d..fc7eda4 100644
--- a/src/nact/nact-clipboard.c
+++ b/src/nact/nact-clipboard.c
@@ -39,9 +39,9 @@
#include <core/na-exporter.h>
#include <core/na-export-format.h>
+#include <core/na-iprefs.h>
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-export-ask.h"
#include "nact-tree-model.h"
#include "nact-clipboard.h"
@@ -603,7 +603,7 @@ export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest
if( index == -1 ){
*exported = g_list_prepend( *exported, ( gpointer ) action );
- format = nact_iprefs_get_export_format( clipboard->private->window, NA_IPREFS_EXPORT_PREFERRED_FORMAT );
+ format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
if( format == IPREFS_EXPORT_FORMAT_ASK ){
format = nact_export_ask_user( clipboard->private->window, NA_OBJECT_ITEM( action ));
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index 1625106..bb27c37 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -37,9 +37,9 @@
#include <api/na-object-api.h>
#include <core/na-exporter.h>
+#include <core/na-iprefs.h>
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-export-format.h"
#include "nact-export-ask.h"
@@ -244,26 +244,29 @@ nact_export_ask_user( BaseWindow *parent, NAObjectItem *item )
{
static const gchar *thisfn = "nact_export_ask_run";
NactExportAsk *editor;
- GQuark format;
-
- g_debug( "%s: parent=%p", thisfn, ( void * ) parent );
+ NactApplication *application;
+ NAUpdater *updater;
- format = ( GQuark ) IPREFS_EXPORT_NO_EXPORT;
+ GQuark format = ( GQuark ) IPREFS_EXPORT_NO_EXPORT;
g_return_val_if_fail( BASE_IS_WINDOW( parent ), format );
+ g_debug( "%s: parent=%p", thisfn, ( void * ) parent );
+
+ application = NACT_APPLICATION( base_window_get_application( parent ));
+ updater = nact_application_get_updater( application );
+
editor = export_ask_new( parent );
editor->private->parent = parent;
editor->private->item = item;
- editor->private->format = nact_iprefs_get_export_format( BASE_WINDOW( parent ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT );
+ editor->private->format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT );
if( base_window_run( BASE_WINDOW( editor ))){
if( editor->private->format ){
-
format = editor->private->format;
- nact_iprefs_set_export_format( BASE_WINDOW( parent ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, format );
+ na_iprefs_set_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_ASK_USER_LAST_FORMAT, format );
}
}
@@ -384,15 +387,20 @@ get_export_format( NactExportAsk *editor )
GQuark format_quark;
GtkWidget *button;
gboolean keep;
+ NactApplication *application;
+ NAUpdater *updater;
container = base_window_get_widget( BASE_WINDOW( editor ), "ExportFormatAskVBox" );
format = nact_export_format_get_selected( container );
format_quark = na_export_format_get_quark( format );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+ updater = nact_application_get_updater( application );
+
button = base_window_get_widget( BASE_WINDOW( editor ), "AskKeepChoiceButton" );
keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
if( keep ){
- nact_iprefs_set_export_format( BASE_WINDOW( editor ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, format_quark );
+ na_iprefs_set_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, format_quark );
}
return( format_quark );
diff --git a/src/nact/nact-export-format.c b/src/nact/nact-export-format.c
index 5b0cbc6..19b8d64 100644
--- a/src/nact/nact-export-format.c
+++ b/src/nact/nact-export-format.c
@@ -37,7 +37,6 @@
#include <core/na-exporter.h>
#include <core/na-export-format.h>
-#include "nact-iprefs.h"
#include "nact-export-format.h"
#define EXPORT_FORMAT_PROP_OBJECT "nact-export-format-prop-object"
diff --git a/src/nact/nact-gtk-utils.c b/src/nact/nact-gtk-utils.c
index 444d019..f5d9514 100644
--- a/src/nact/nact-gtk-utils.c
+++ b/src/nact/nact-gtk-utils.c
@@ -39,7 +39,6 @@
#include <core/na-updater.h>
#include "base-iprefs.h"
-#include "nact-iprefs.h"
#include "nact-gtk-utils.h"
#include "nact-application.h"
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index b077eb3..2e7bfc1 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -43,7 +43,6 @@
#include "base-iprefs.h"
#include "base-window.h"
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-main-statusbar.h"
#include "nact-gtk-utils.h"
#include "nact-iactions-list.h"
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 770c7db..e827128 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -47,7 +47,6 @@
#include "nact-application.h"
#include "nact-main-statusbar.h"
#include "nact-gtk-utils.h"
-#include "nact-iprefs.h"
#include "nact-iactions-list.h"
#include "nact-main-tab.h"
#include "nact-icommand-tab.h"
diff --git a/src/nact/nact-ifolders-tab.c b/src/nact/nact-ifolders-tab.c
index 87e5870..7cd0eeb 100644
--- a/src/nact/nact-ifolders-tab.c
+++ b/src/nact/nact-ifolders-tab.c
@@ -43,7 +43,6 @@
#include "base-iprefs.h"
#include "base-window.h"
#include "nact-gtk-utils.h"
-#include "nact-iprefs.h"
#include "nact-application.h"
#include "nact-main-tab.h"
#include "nact-match-list.h"
diff --git a/src/nact/nact-main-toolbar.c b/src/nact/nact-main-toolbar.c
index d6c8264..4e344bd 100644
--- a/src/nact/nact-main-toolbar.c
+++ b/src/nact/nact-main-toolbar.c
@@ -35,7 +35,6 @@
#include <core/na-iprefs.h>
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-main-toolbar.h"
typedef struct {
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 0d26f89..ad867cd 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -37,7 +37,6 @@
#include <core/na-iprefs.h>
#include "nact-application.h"
-#include "nact-iprefs.h"
#include "nact-export-format.h"
#include "nact-schemes-list.h"
#include "nact-providers-list.h"
@@ -419,7 +418,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
/* fourth tab: export tool
*/
- export_format = nact_iprefs_get_export_format( BASE_WINDOW( editor ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
+ export_format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT );
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
nact_export_format_select( container, export_format );
@@ -644,8 +643,8 @@ save_preferences( NactPreferencesEditor *editor )
*/
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
export_format = nact_export_format_get_selected( container );
- nact_iprefs_set_export_format(
- BASE_WINDOW( editor ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( export_format ));
+ na_iprefs_set_export_format(
+ NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( export_format ));
/* fifth tab: list of default schemes
*/
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 4c9b3d1..a8a8bc9 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -46,7 +46,6 @@
#include "nact-application.h"
#include "nact-clipboard.h"
#include "nact-iactions-list.h"
-#include "nact-iprefs.h"
#include "nact-main-menubar-edit.h"
#include "nact-main-statusbar.h"
#include "nact-main-window.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]