[nautilus-actions] NactPreferencesEditor: default to rely on runtime detection
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] NactPreferencesEditor: default to rely on runtime detection
- Date: Thu, 12 Jan 2012 23:23:15 +0000 (UTC)
commit 7af32a58c0eede99948614d1b8b20fb67ee56628
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jan 13 00:19:55 2012 +0100
NactPreferencesEditor: default to rely on runtime detection
Display the currently detected desktop identifier.
ChangeLog | 7 +++++
src/nact/nact-preferences-editor.c | 52 +++++++++++++++++++++++++-----------
src/nact/nact-preferences-editor.h | 14 +++++-----
src/nact/nact-preferences.ui | 35 +++++++++++++++++-------
4 files changed, 75 insertions(+), 33 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d782cb2..140f63f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-01-12 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-preferences-editor.h:
+ * src/nact/nact-preferences.ui:
+ Rename NACT_PREFERENCES_EDITOR_TYPE GType macro to NACT_TYPE_PREFERENCES_EDITOR.
+ Set "Relying on runtime detection" as default in "Runtime execution" tab.
+ Display the detected desktop identifier.
+
* src/nact/nact-ienvironment-tab.c
(dispose_selection_count_combobox): Check that we have a GtkComboBox.
(dispose_desktop_listview): Check that we have a GtkTreeView.
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index da029b9..a4b3773 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -115,7 +115,7 @@ enum {
};
/* i18n: the user is not willing to identify his current desktop environment,
- * and prefers rely onthe runtime detection */
+ * and prefers rely on the runtime detection */
static const NADesktopEnv st_no_desktop = { "None", N_( "Rely on runtime detection" ) };
static const gchar *st_xmlui_filename = PKGDATADIR "/nact-preferences.ui";
@@ -134,8 +134,8 @@ static NAIOption *ioptions_list_get_ask_option( const NAIOptionsList *instance,
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *dialog );
static void instance_finalize( GObject *dialog );
-static void on_base_initialize_gtk_toplevel( NactPreferencesEditor *editor, GtkDialog *toplevel );
-static void on_base_initialize_base_window( NactPreferencesEditor *editor );
+static void on_base_initialize_gtk( NactPreferencesEditor *editor, GtkDialog *toplevel );
+static void on_base_initialize_window( NactPreferencesEditor *editor );
static void on_base_all_widgets_showed( NactPreferencesEditor *editor );
static void order_mode_setup( NactPreferencesEditor *editor );
static void order_mode_on_alpha_asc_toggled( GtkToggleButton *togglebutton, NactPreferencesEditor *editor );
@@ -343,13 +343,13 @@ instance_init( GTypeInstance *instance, gpointer klass )
BASE_WINDOW( instance ),
G_OBJECT( instance ),
BASE_SIGNAL_INITIALIZE_GTK,
- G_CALLBACK( on_base_initialize_gtk_toplevel ));
+ G_CALLBACK( on_base_initialize_gtk ));
base_window_signal_connect(
BASE_WINDOW( instance ),
G_OBJECT( instance ),
BASE_SIGNAL_INITIALIZE_WINDOW,
- G_CALLBACK( on_base_initialize_base_window ));
+ G_CALLBACK( on_base_initialize_window ));
base_window_signal_connect(
BASE_WINDOW( instance ),
@@ -424,7 +424,7 @@ nact_preferences_editor_run( BaseWindow *parent )
g_debug( "%s: parent=%p (%s)", thisfn, ( void * ) parent, G_OBJECT_TYPE_NAME( parent ));
- editor = g_object_new( NACT_PREFERENCES_EDITOR_TYPE,
+ editor = g_object_new( NACT_TYPE_PREFERENCES_EDITOR,
BASE_PROP_PARENT, parent,
BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
/*
@@ -451,9 +451,9 @@ nact_preferences_editor_run( BaseWindow *parent )
}
static void
-on_base_initialize_gtk_toplevel( NactPreferencesEditor *editor, GtkDialog *toplevel )
+on_base_initialize_gtk( NactPreferencesEditor *editor, GtkDialog *toplevel )
{
- static const gchar *thisfn = "nact_preferences_editor_on_base_initialize_gtk_toplevel";
+ static const gchar *thisfn = "nact_preferences_editor_on_base_initialize_gtk";
GtkWidget *container;
GtkTreeView *listview;
@@ -483,9 +483,9 @@ on_base_initialize_gtk_toplevel( NactPreferencesEditor *editor, GtkDialog *tople
}
static void
-on_base_initialize_base_window( NactPreferencesEditor *editor )
+on_base_initialize_window( NactPreferencesEditor *editor )
{
- static const gchar *thisfn = "nact_preferences_editor_on_base_initialize_base_window";
+ static const gchar *thisfn = "nact_preferences_editor_on_base_initialize_window";
GtkWidget *container;
GtkTreeView *listview;
GtkWidget *ok_button;
@@ -814,14 +814,18 @@ desktop_create_model( NactPreferencesEditor *editor )
gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT( combo ), text_cell, "text", 0, NULL );
gtk_cell_renderer_set_visible( GTK_CELL_RENDERER( text_cell ), TRUE );
+ /* insert the "rely on runtime detection item"
+ * this item must be inserted first (see desktop_setup())
+ */
gtk_list_store_append( model, &row );
gtk_list_store_set( model, &row,
DESKTOP_ID_COLUMN, st_no_desktop.id,
DESKTOP_LABEL_COLUMN, gettext( st_no_desktop.label ),
-1 );
+ /* insert list of known desktops
+ */
desktops = na_desktop_environment_get_known_list();
-
for( i = 0 ; desktops[i].id ; ++i ){
gtk_list_store_append( model, &row );
gtk_list_store_set( model, &row,
@@ -838,11 +842,11 @@ desktop_setup( NactPreferencesEditor *editor )
const NADesktopEnv *desktops;
guint i;
gint found;
+ GtkWidget *widget;
+ const gchar *desktop;
- editor->private->desktop = na_settings_get_string( NA_IPREFS_DESKTOP_ENVIRONMENT, NULL, &editor->private->desktop_mandatory );
-
- combo = base_window_get_widget( BASE_WINDOW( editor ), "DesktopComboBox" );
found = -1;
+ editor->private->desktop = na_settings_get_string( NA_IPREFS_DESKTOP_ENVIRONMENT, NULL, &editor->private->desktop_mandatory );
if( editor->private->desktop && strlen( editor->private->desktop )){
desktops = na_desktop_environment_get_known_list();
@@ -853,10 +857,26 @@ desktop_setup( NactPreferencesEditor *editor )
}
}
+ /* if the user has not selected a "preferred" desktop,
+ * we suppose he relies on runtime detection
+ */
+ if( found == -1 ){
+ found = 0;
+ }
+
+ combo = base_window_get_widget( BASE_WINDOW( editor ), "DesktopComboBox" );
gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), found );
- base_window_signal_connect( BASE_WINDOW( editor ),
- G_OBJECT( combo ), "changed", G_CALLBACK( desktop_on_changed ));
+ base_window_signal_connect(
+ BASE_WINDOW( editor ),
+ G_OBJECT( combo ), "changed",
+ G_CALLBACK( desktop_on_changed ));
+
+ /* set the currently detected desktop
+ */
+ widget = base_window_get_widget( BASE_WINDOW( editor ), "DesktopLabel" );
+ desktop = na_desktop_environment_detect_running_desktop();
+ gtk_label_set_text( GTK_LABEL( widget ), desktop );
}
static void
diff --git a/src/nact/nact-preferences-editor.h b/src/nact/nact-preferences-editor.h
index 2b458dc..0aebaf3 100644
--- a/src/nact/nact-preferences-editor.h
+++ b/src/nact/nact-preferences-editor.h
@@ -44,12 +44,12 @@
G_BEGIN_DECLS
-#define NACT_PREFERENCES_EDITOR_TYPE ( nact_preferences_editor_get_type())
-#define NACT_PREFERENCES_EDITOR( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_PREFERENCES_EDITOR_TYPE, NactPreferencesEditor ))
-#define NACT_PREFERENCES_EDITOR_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_PREFERENCES_EDITOR_TYPE, NactPreferencesEditorClass ))
-#define NACT_IS_PREFERENCES_EDITOR( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_PREFERENCES_EDITOR_TYPE ))
-#define NACT_IS_PREFERENCES_EDITOR_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_PREFERENCES_EDITOR_TYPE ))
-#define NACT_PREFERENCES_EDITOR_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_PREFERENCES_EDITOR_TYPE, NactPreferencesEditorClass ))
+#define NACT_TYPE_PREFERENCES_EDITOR ( nact_preferences_editor_get_type())
+#define NACT_PREFERENCES_EDITOR( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_TYPE_PREFERENCES_EDITOR, NactPreferencesEditor ))
+#define NACT_PREFERENCES_EDITOR_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_TYPE_PREFERENCES_EDITOR, NactPreferencesEditorClass ))
+#define NACT_IS_PREFERENCES_EDITOR( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_TYPE_PREFERENCES_EDITOR ))
+#define NACT_IS_PREFERENCES_EDITOR_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_TYPE_PREFERENCES_EDITOR ))
+#define NACT_PREFERENCES_EDITOR_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_TYPE_PREFERENCES_EDITOR, NactPreferencesEditorClass ))
typedef struct _NactPreferencesEditorPrivate NactPreferencesEditorPrivate;
@@ -71,7 +71,7 @@ typedef struct {
GType nact_preferences_editor_get_type( void );
-void nact_preferences_editor_run( BaseWindow *parent );
+void nact_preferences_editor_run ( BaseWindow *parent );
G_END_DECLS
diff --git a/src/nact/nact-preferences.ui b/src/nact/nact-preferences.ui
index cfa16c6..4377dbd 100644
--- a/src/nact/nact-preferences.ui
+++ b/src/nact/nact-preferences.ui
@@ -10,7 +10,6 @@
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkNotebook" id="PreferencesNotebook">
@@ -280,6 +279,7 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<child>
<object class="GtkTable" id="table721">
<property name="visible">True</property>
+ <property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">4</property>
<property name="row_spacing">4</property>
@@ -290,19 +290,38 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<property name="label" translatable="yes">Running _desktop environment :</property>
<property name="use_underline">True</property>
</object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="DesktopComboBox">
+ <property name="visible">True</property>
+ </object>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="DesktopComboBox">
+ <object class="GtkLabel" id="label6">
<property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes"><i>Currently detected :</i></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="DesktopLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
</object>
@@ -638,7 +657,6 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
@@ -656,7 +674,6 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<object class="GtkVBox" id="PreferencesImportModeVBox">
<property name="visible">True</property>
<property name="border_width">6</property>
- <property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
@@ -718,7 +735,6 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<child>
<object class="GtkVBox" id="vbox15">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
@@ -736,7 +752,6 @@ This command should include a 'COMMAND' keyword, which will be substituted at ru
<object class="GtkVBox" id="PreferencesExportFormatVBox">
<property name="visible">True</property>
<property name="border_width">6</property>
- <property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
@@ -1092,8 +1107,8 @@ You can add a new scheme by clicking on the '+' button.</property>
</object>
<object class="GtkSizeGroup" id="RuntimeExecutionLabel">
<widgets>
- <widget name="label721"/>
<widget name="label711"/>
+ <widget name="label721"/>
</widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]