[nautilus-actions] The main window is now a GtkApplicationWindow
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] The main window is now a GtkApplicationWindow
- Date: Wed, 15 Feb 2017 22:44:30 +0000 (UTC)
commit df59672107f7027fb871289e24a49c2925cfc572
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jul 9 17:16:08 2015 +0200
The main window is now a GtkApplicationWindow
src/nact/base-gtk-utils.c | 30 ++++++++++++------------------
src/nact/base-gtk-utils.h | 6 +++---
src/nact/nact-add-capability-dialog.c | 2 +-
src/nact/nact-add-scheme-dialog.c | 2 +-
src/nact/nact-iaction-tab.c | 4 ++--
src/nact/nact-icommand-tab.c | 31 ++++++++++++++++++++-----------
src/nact/nact-icon-chooser.c | 17 ++++++++---------
src/nact/nact-icon-chooser.h | 3 ++-
src/nact/nact-ienvironment-tab.c | 4 ++--
9 files changed, 51 insertions(+), 48 deletions(-)
---
diff --git a/src/nact/base-gtk-utils.c b/src/nact/base-gtk-utils.c
index 7fcad55..5b626a0 100644
--- a/src/nact/base-gtk-utils.c
+++ b/src/nact/base-gtk-utils.c
@@ -336,7 +336,7 @@ base_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSize size )
/**
* base_gtk_utils_select_file:
- * @window: the #BaseWindow which will be the parent of the dialog box.
+ * @window: the #NactMainWindow which will be the parent of the dialog box.
* @title: the title of the dialog box.
* @wsp_name: the name of the dialog box in Preferences to read/write
* its size and position.
@@ -352,7 +352,7 @@ base_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSize size )
* URI will be written as @entry_name in Preferences.
*/
void
-base_gtk_utils_select_file( BaseWindow *window,
+base_gtk_utils_select_file( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name )
{
@@ -362,7 +362,7 @@ base_gtk_utils_select_file( BaseWindow *window,
/**
* base_gtk_utils_select_file_with_preview:
- * @window: the #BaseWindow which will be the parent of the dialog box.
+ * @window: the #NactMainWindow which will be the parent of the dialog box.
* @title: the title of the dialog box.
* @wsp_name: the name of the dialog box in Preferences to read/write
* its size and position.
@@ -380,22 +380,19 @@ base_gtk_utils_select_file( BaseWindow *window,
* URI will be written as @entry_name in Preferences.
*/
void
-base_gtk_utils_select_file_with_preview( BaseWindow *window,
+base_gtk_utils_select_file_with_preview( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name,
GCallback update_preview_cb )
{
- GtkWindow *toplevel;
GtkWidget *dialog;
const gchar *text;
gchar *filename, *uri;
GtkWidget *preview;
- toplevel = base_window_get_gtk_toplevel( window );
-
dialog = gtk_file_chooser_dialog_new(
title,
- toplevel,
+ NULL /*GTK_WINDOW( window )*/,
GTK_FILE_CHOOSER_ACTION_OPEN,
_( "_Cancel" ), GTK_RESPONSE_CANCEL,
_( "_OK" ), GTK_RESPONSE_ACCEPT,
@@ -408,7 +405,7 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
g_signal_connect( dialog, "update-preview", update_preview_cb, preview );
}
- base_gtk_utils_restore_window_position( window, wsp_name );
+ na_gtk_utils_restore_window_position( GTK_WINDOW( dialog ), wsp_name );
text = gtk_entry_get_text( GTK_ENTRY( entry ));
@@ -433,14 +430,14 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
na_settings_set_string( entry_name, uri );
g_free( uri );
- base_gtk_utils_save_window_position( window, wsp_name );
+ na_gtk_utils_save_window_position( GTK_WINDOW( dialog ), wsp_name );
gtk_widget_destroy( dialog );
}
/**
* base_gtk_utils_select_dir:
- * @window: the #BaseWindow which will be the parent of the dialog box.
+ * @window: the #NactMainWindow which will be the parent of the dialog box.
* @title: the title of the dialog box.
* @wsp_name: the name of the dialog box in Preferences to read/write
* its size and position.
@@ -458,27 +455,24 @@ base_gtk_utils_select_file_with_preview( BaseWindow *window,
* URI will be written as @entry_name in Preferences.
*/
void
-base_gtk_utils_select_dir( BaseWindow *window,
+base_gtk_utils_select_dir( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name )
{
- GtkWindow *toplevel;
GtkWidget *dialog;
const gchar *text;
gchar *dir, *uri;
- toplevel = base_window_get_gtk_toplevel( window );
-
dialog = gtk_file_chooser_dialog_new(
title,
- toplevel,
+ NULL /*GTK_WINDOW( window )*/,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_( "_Cancel" ), GTK_RESPONSE_CANCEL,
_( "_OK" ), GTK_RESPONSE_ACCEPT,
NULL
);
- base_gtk_utils_restore_window_position( window, wsp_name );
+ na_gtk_utils_restore_window_position( GTK_WINDOW( dialog ), wsp_name );
text = gtk_entry_get_text( GTK_ENTRY( entry ));
@@ -503,7 +497,7 @@ base_gtk_utils_select_dir( BaseWindow *window,
na_settings_set_string( entry_name, uri );
g_free( uri );
- base_gtk_utils_save_window_position( window, wsp_name );
+ na_gtk_utils_save_window_position( GTK_WINDOW( dialog ), wsp_name );
gtk_widget_destroy( dialog );
}
diff --git a/src/nact/base-gtk-utils.h b/src/nact/base-gtk-utils.h
index f0296ca..cd1d880 100644
--- a/src/nact/base-gtk-utils.h
+++ b/src/nact/base-gtk-utils.h
@@ -71,16 +71,16 @@ void base_gtk_utils_render( const gchar *name, GtkImage *widget, GtkIconSi
/* standard dialog boxes
*/
-void base_gtk_utils_select_file( BaseWindow *window,
+void base_gtk_utils_select_file( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name );
-void base_gtk_utils_select_file_with_preview( BaseWindow *window,
+void base_gtk_utils_select_file_with_preview( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name,
GCallback update_preview_cb );
-void base_gtk_utils_select_dir( BaseWindow *window,
+void base_gtk_utils_select_dir( GtkApplicationWindow *window,
const gchar *title, const gchar *wsp_name,
GtkWidget *entry, const gchar *entry_name );
diff --git a/src/nact/nact-add-capability-dialog.c b/src/nact/nact-add-capability-dialog.c
index 62a6e94..ca4327e 100644
--- a/src/nact/nact-add-capability-dialog.c
+++ b/src/nact/nact-add-capability-dialog.c
@@ -297,7 +297,7 @@ nact_add_capability_dialog_run( NactMainWindow *parent, GSList *capabilities )
g_debug( "%s: parent=%p", thisfn, ( void * ) parent );
- g_return_val_if_fail( BASE_IS_WINDOW( parent ), NULL );
+ g_return_val_if_fail( GTK_IS_APPLICATION_WINDOW( parent ), NULL );
dialog = g_object_new( NACT_TYPE_ADD_CAPABILITY_DIALOG,
BASE_PROP_MAIN_WINDOW, parent,
diff --git a/src/nact/nact-add-scheme-dialog.c b/src/nact/nact-add-scheme-dialog.c
index 434dca2..1173efa 100644
--- a/src/nact/nact-add-scheme-dialog.c
+++ b/src/nact/nact-add-scheme-dialog.c
@@ -262,7 +262,7 @@ nact_add_scheme_dialog_run( NactMainWindow *parent, GSList *schemes )
g_debug( "%s: parent=%p", thisfn, ( void * ) parent );
- g_return_val_if_fail( BASE_IS_WINDOW( parent ), NULL );
+ g_return_val_if_fail( GTK_IS_APPLICATION_WINDOW( parent ), NULL );
dialog = g_object_new( NACT_TYPE_ADD_SCHEME_DIALOG,
BASE_PROP_MAIN_WINDOW, parent,
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index ed766b9..52589d9 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -843,7 +843,7 @@ on_icon_browse( GtkButton *button, NactIActionTab *instance )
if( item ){
icon_name = na_object_get_icon( item );
- new_icon_name = nact_icon_chooser_choose_icon( BASE_WINDOW( instance ), icon_name );
+ new_icon_name = nact_icon_chooser_choose_icon( NACT_MAIN_WINDOW( instance ), icon_name );
if( g_utf8_collate( icon_name, new_icon_name ) != 0 ){
icon_entry = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconEntry" );
@@ -893,7 +893,7 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
/* icon_name may be null if there is no current item
* in such a case, we blank the image
*/
- image = GTK_IMAGE( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconImage" ));
+ image = GTK_IMAGE( na_gtk_utils_find_widget_by_name( GTK_CONTAINER( instance ), "ActionIconImage" ));
base_gtk_utils_render( icon_name, image, GTK_ICON_SIZE_SMALL_TOOLBAR );
g_free( icon_name );
}
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 51bd985..ef846dc 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -191,13 +191,11 @@ nact_icommand_tab_init( NactICommandTab *instance )
( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
nact_main_tab_init( NACT_MAIN_WINDOW( instance ), TAB_COMMAND );
- initialize_gtk( instance );
- initialize_window( instance );
-
data = get_icommand_data( instance );
data->on_selection_change = FALSE;
data->tokens = NULL;
-
+ initialize_gtk( instance );
+ initialize_window( instance );
g_object_weak_ref( G_OBJECT( instance ), ( GWeakNotify ) on_instance_finalized, NULL );
}
@@ -286,6 +284,7 @@ initialize_window( NactICommandTab *instance )
data = get_icommand_data( instance );
if( !data->tokens ){
data->tokens = na_tokens_new_for_example();
+ g_debug( "%s: data=%p, tokens=%p", thisfn, ( void * ) data, ( void * ) data->tokens );
}
}
@@ -330,6 +329,8 @@ on_tree_selection_changed( NactTreeView *tview, GList *selected_items, NactIComm
MAIN_PROP_PROFILE, &profile,
MAIN_PROP_EDITABLE, &editable,
NULL );
+ g_debug( "%s: profile=%p (%s)",
+ thisfn, ( void * ) profile, G_OBJECT_TYPE_NAME( profile ));
enable_tab = ( profile != NULL );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
@@ -538,7 +539,7 @@ static void
on_path_browse( GtkButton *button, NactICommandTab *instance )
{
base_gtk_utils_select_file(
- BASE_WINDOW( instance ),
+ GTK_APPLICATION_WINDOW( instance ),
_( "Choosing a command" ), NA_IPREFS_COMMAND_CHOOSER_WSP,
get_path_entry( instance ), NA_IPREFS_COMMAND_CHOOSER_URI );
}
@@ -577,10 +578,14 @@ on_wdir_browse( GtkButton *button, NactICommandTab *instance )
NULL );
if( profile ){
- wdir_entry = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( instance ),
"WorkingDirectoryEntry" );
+ wdir_entry = na_gtk_utils_find_widget_by_name(
+ GTK_CONTAINER( instance ), "WorkingDirectoryEntry" );
base_gtk_utils_select_dir(
- BASE_WINDOW( instance ), _( "Choosing a working directory" ),
- NA_IPREFS_WORKING_DIR_WSP, wdir_entry, NA_IPREFS_WORKING_DIR_URI );
+ GTK_APPLICATION_WINDOW( instance ),
+ _( "Choosing a working directory" ),
+ NA_IPREFS_WORKING_DIR_WSP,
+ wdir_entry,
+ NA_IPREFS_WORKING_DIR_URI );
}
}
@@ -611,6 +616,8 @@ on_wdir_changed( GtkEntry *entry, NactICommandTab *instance )
static gchar *
parse_parameters( NactICommandTab *instance )
{
+ static const gchar *thisfn = "nact_icommand_tab_parse_parameters";
+
const gchar *command = gtk_entry_get_text( GTK_ENTRY( get_path_entry( instance )));
const gchar *param_template = gtk_entry_get_text( GTK_ENTRY( get_parameters_entry( instance )));
gchar *exec, *returned;
@@ -618,6 +625,8 @@ parse_parameters( NactICommandTab *instance )
data = get_icommand_data( instance );
exec = g_strdup_printf( "%s %s", command, param_template );
+ g_debug( "%s: data=%p, tokens=%p, exec=%s",
+ thisfn, ( void * ) data, ( void * ) data->tokens, exec );
returned = na_tokens_parse_for_display( data->tokens, exec, FALSE );
g_free( exec );
@@ -651,21 +660,21 @@ update_example_label( NactICommandTab *instance, NAObjectProfile *profile )
newlabel = g_strdup( "" );
}
- gtk_label_set_label( GTK_LABEL( example_widget ), newlabel );
+ gtk_label_set_markup( GTK_LABEL( example_widget ), newlabel );
g_free( newlabel );
}
static ICommandData *
get_icommand_data( NactICommandTab *instance )
{
+ static const gchar *thisfn = "nact_icommand_tab_get_icommand_data";
ICommandData *data;
data = ( ICommandData * ) g_object_get_data( G_OBJECT( instance ), ICOMMAND_TAB_PROP_DATA );
if( !data ){
data = g_new0( ICommandData, 1 );
- /* g_object_set_data_full() would be called after the weak ref function
- */
+ g_debug( "%s: allocating new ICommandData structure at %p", thisfn, ( void * ) data );
g_object_set_data( G_OBJECT( instance ), ICOMMAND_TAB_PROP_DATA, data );
}
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index ac261d2..dc0a870 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -37,6 +37,7 @@
#include "nact-application.h"
#include "base-gtk-utils.h"
#include "nact-icon-chooser.h"
+#include "nact-main-window.h"
/* private class data
*/
@@ -47,11 +48,10 @@ struct _NactIconChooserClassPrivate {
/* private instance data
*/
struct _NactIconChooserPrivate {
- gboolean dispose_has_run;
- BaseWindow *main_window;
- const gchar *initial_icon;
- gchar *current_icon;
- GtkWidget *path_preview;
+ gboolean dispose_has_run;
+ const gchar *initial_icon;
+ gchar *current_icon;
+ GtkWidget *path_preview;
};
#define VIEW_ICON_SIZE GTK_ICON_SIZE_DND
@@ -307,24 +307,23 @@ instance_finalize( GObject *dialog )
* by the caller.
*/
gchar *
-nact_icon_chooser_choose_icon( BaseWindow *parent, const gchar *icon_name )
+nact_icon_chooser_choose_icon( NactMainWindow *parent, const gchar *icon_name )
{
static const gchar *thisfn = "nact_icon_chooser_choose_icon";
NactIconChooser *editor;
gchar *new_name;
- g_return_val_if_fail( BASE_IS_WINDOW( parent ), NULL );
+ g_return_val_if_fail( parent && GTK_IS_APPLICATION_WINDOW( parent ), NULL );
g_debug( "%s: parent=%p, icon_name=%s", thisfn, ( void * ) parent, icon_name );
editor = g_object_new( NACT_TYPE_ICON_CHOOSER,
- BASE_PROP_MAIN_WINDOW, parent,
+ BASE_PROP_MAIN_WINDOW, parent,
BASE_PROP_XMLUI_FILENAME, st_xmlui_filename,
BASE_PROP_TOPLEVEL_NAME, st_toplevel_name,
BASE_PROP_WSP_NAME, st_wsp_name,
NULL );
- editor->private->main_window = parent;
editor->private->initial_icon = icon_name;
new_name = g_strdup( editor->private->initial_icon );
diff --git a/src/nact/nact-icon-chooser.h b/src/nact/nact-icon-chooser.h
index 73a7925..519efab 100644
--- a/src/nact/nact-icon-chooser.h
+++ b/src/nact/nact-icon-chooser.h
@@ -39,6 +39,7 @@
*/
#include "base-dialog.h"
+#include "nact-main-window-def.h"
G_BEGIN_DECLS
@@ -69,7 +70,7 @@ typedef struct {
GType nact_icon_chooser_get_type( void );
-gchar *nact_icon_chooser_choose_icon( BaseWindow *main_window, const gchar *icon_name );
+gchar *nact_icon_chooser_choose_icon( NactMainWindow *main_window, const gchar *icon_name );
G_END_DECLS
diff --git a/src/nact/nact-ienvironment-tab.c b/src/nact/nact-ienvironment-tab.c
index c3265db..5f7bf5b 100644
--- a/src/nact/nact-ienvironment-tab.c
+++ b/src/nact/nact-ienvironment-tab.c
@@ -726,7 +726,7 @@ on_try_exec_browse( GtkButton *button, NactIEnvironmentTab *instance )
entry = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( instance ), "TryExecEntry" );
base_gtk_utils_select_file(
- BASE_WINDOW( instance ),
+ GTK_APPLICATION_WINDOW( instance ),
_( "Choosing an executable" ), NA_IPREFS_TRY_EXEC_WSP,
entry, NA_IPREFS_TRY_EXEC_URI );
}
@@ -784,7 +784,7 @@ on_show_if_running_browse( GtkButton *button, NactIEnvironmentTab *instance )
entry = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( instance ), "ShowIfRunningEntry" );
base_gtk_utils_select_file(
- BASE_WINDOW( instance ),
+ GTK_APPLICATION_WINDOW( instance ),
_( "Choosing an executable" ), NA_IPREFS_SHOW_IF_RUNNING_WSP,
entry, NA_IPREFS_SHOW_IF_RUNNING_URI );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]