[nautilus-actions] Icon chooser: implement preferences
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Icon chooser: implement preferences
- Date: Wed, 19 Jan 2011 21:51:55 +0000 (UTC)
commit c1a4fadfe311912188e850ab06a8b9da12139cfb
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Jan 12 21:44:40 2011 +0100
Icon chooser: implement preferences
ChangeLog | 3 ++
src/nact/nact-icon-chooser.c | 56 +++++++++++++++++++++++++++++++---------
src/nact/nact-icon-chooser.ui | 4 +-
3 files changed, 48 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c6488ca..b3d75fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,9 @@
2011-01-12 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-icon-chooser.c:
+ * src/nact/nact-icon-chooser.ui: Implement all preferences.
+
* src/utils/na-gconf2key.sh.in:
Renamed preferences for windows size and position '-wsp'.
Also delete from GConf if only preferences have been migrated.
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index 509f699..75ed09c 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -34,6 +34,8 @@
#include <gdk/gdkkeysyms.h>
+#include "base-iprefs.h"
+#include "nact-application.h"
#include "nact-gtk-utils.h"
#include "nact-icon-chooser.h"
@@ -226,6 +228,8 @@ instance_dispose( GObject *dialog )
{
static const gchar *thisfn = "nact_icon_chooser_instance_dispose";
NactIconChooser *self;
+ guint pos;
+ GtkWidget *paned;
g_return_if_fail( NACT_IS_ICON_CHOOSER( dialog ));
@@ -237,6 +241,10 @@ instance_dispose( GObject *dialog )
self->private->dispose_has_run = TRUE;
+ paned = base_window_get_widget( BASE_WINDOW( self ), "IconPaned" );
+ pos = gtk_paned_get_position( GTK_PANED( paned ));
+ base_iprefs_set_int( BASE_WINDOW( self ), "item-icon-chooser-paned-width", pos );
+
/* chain up to the parent class */
if( G_OBJECT_CLASS( st_parent_class )->dispose ){
G_OBJECT_CLASS( st_parent_class )->dispose( dialog );
@@ -318,7 +326,7 @@ nact_icon_chooser_choose_icon( BaseWindow *parent, const gchar *icon_name )
static gchar *
base_get_iprefs_window_id( const BaseWindow *window )
{
- return( g_strdup( "icon-chooser-dialog-size" ));
+ return( g_strdup( "item-icon-chooser-wsp" ));
}
static gchar *
@@ -429,13 +437,18 @@ static void
on_base_runtime_init_dialog( NactIconChooser *editor, gpointer user_data )
{
static const gchar *thisfn = "nact_icon_chooser_on_runtime_init_dialog";
+ guint pos;
+ GtkWidget *paned;
g_return_if_fail( NACT_IS_ICON_CHOOSER( editor ));
g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
- GtkDialog *dialog = GTK_DIALOG( base_window_get_toplevel( BASE_WINDOW( editor )));
- g_debug( "%s: eeditor=%p, dialog=%p", thisfn, ( void * ) editor, ( void * ) dialog );
+ pos = base_iprefs_get_int( BASE_WINDOW( editor ), "item-icon-chooser-paned-width" );
+ if( pos ){
+ paned = base_window_get_widget( BASE_WINDOW( editor ), "IconPaned" );
+ gtk_paned_set_position( GTK_PANED( paned ), pos );
+ }
/* setup the initial icon
*/
@@ -496,15 +509,26 @@ static void
fillup_icons_by_path( NactIconChooser *editor )
{
GtkFileChooser *file_chooser;
+ NactApplication *application;
+ NAUpdater *updater;
+ NASettings *settings;
+ gchar *uri;
file_chooser = GTK_FILE_CHOOSER( base_window_get_widget( BASE_WINDOW( editor ), "FileChooser" ));
editor->private->path_preview = gtk_image_new();
gtk_file_chooser_set_preview_widget( file_chooser, editor->private->path_preview );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+ updater = nact_application_get_updater( application );
+ settings = na_pivot_get_settings( NA_PIVOT( updater ));
+
gtk_file_chooser_unselect_all( file_chooser );
- /*if( window->private->path_last_selection ){
- gtk_file_chooser_set_filename( file_chooser, window->private->path_last_selection );
- } else*/ if( editor->private->current_icon ){
+
+ uri = na_settings_get_string( settings, "item-icon-chooser-last-uri", NULL, NULL );
+ if( uri ){
+ gtk_file_chooser_set_uri( file_chooser, uri );
+ g_free( uri );
+ } else if( editor->private->current_icon ){
gtk_file_chooser_set_filename( file_chooser, editor->private->current_icon );
}
@@ -798,13 +822,19 @@ on_themed_apply_triggered( NactIconChooser *editor )
static void
on_path_selection_changed( GtkFileChooser *file_chooser, NactIconChooser *editor )
{
- gchar *filename;
-
- filename = gtk_file_chooser_get_filename( file_chooser );
- /*if( filename ){
- g_free( window->private->path_last_selection );
- window->private->path_last_selection = filename;
- }*/
+ gchar *uri;
+ NactApplication *application;
+ NAUpdater *updater;
+ NASettings *settings;
+
+ uri = gtk_file_chooser_get_uri( file_chooser );
+ if( uri ){
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+ updater = nact_application_get_updater( application );
+ settings = na_pivot_get_settings( NA_PIVOT( updater ));
+ na_settings_set_string( settings, "item-icon-chooser-last-uri", uri );
+ g_free( uri );
+ }
}
static void
diff --git a/src/nact/nact-icon-chooser.ui b/src/nact/nact-icon-chooser.ui
index 5c5b425..36ba444 100644
--- a/src/nact/nact-icon-chooser.ui
+++ b/src/nact/nact-icon-chooser.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.12"/>
+ <!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="IconChooserDialog">
<property name="border_width">6</property>
@@ -78,7 +78,7 @@
<object class="GtkHBox" id="hbox110">
<property name="visible">True</property>
<child>
- <object class="GtkHPaned" id="hpaned1">
+ <object class="GtkHPaned" id="IconPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]