Update copyright message
[nautilus-actions.git] / src / nact / nact-icommand-tab.c
blob8874fd325b4b1caed382d2a6c7d8bbd3db75eb5a
1 /*
2 * Nautilus Actions
3 * A Nautilus extension which offers configurable context menu actions.
5 * Copyright (C) 2005 The GNOME Foundation
6 * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7 * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
9 * This Program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This Program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this Library; see the file COPYING. If not,
21 * write to the Free Software Foundation, Inc., 59 Temple Place,
22 * Suite 330, Boston, MA 02111-1307, USA.
24 * Authors:
25 * Frederic Ruaudel <grumz@grumz.net>
26 * Rodrigo Moya <rodrigo@gnome-db.org>
27 * Pierre Wieser <pwieser@trychlos.org>
28 * ... and many others (see AUTHORS)
31 #ifdef HAVE_CONFIG_H
32 #include <config.h>
33 #endif
35 #include <glib/gi18n.h>
36 #include <string.h>
38 #include <api/na-core-utils.h>
39 #include <api/na-object-api.h>
41 #include <core/na-iprefs.h>
42 #include <core/na-factory-object.h>
43 #include <core/na-tokens.h>
45 #include "base-window.h"
46 #include "base-iprefs.h"
47 #include "nact-application.h"
48 #include "nact-main-statusbar.h"
49 #include "nact-gtk-utils.h"
50 #include "nact-iprefs.h"
51 #include "nact-iactions-list.h"
52 #include "nact-main-tab.h"
53 #include "nact-icommand-tab.h"
54 #include "nact-ischemes-tab.h"
56 /* private interface data
58 struct NactICommandTabInterfacePrivate {
59 void *empty; /* so that gcc -pedantic is happy */
62 /* the GConf key used to read/write size and position of auxiliary dialogs
64 #define IPREFS_LEGEND_DIALOG "icommand-legend-dialog"
65 #define IPREFS_COMMAND_CHOOSER "icommand-command-chooser"
66 #define IPREFS_FOLDER_URI "icommand-folder-uri"
67 #define IPREFS_WORKING_DIR_DIALOG "icommand-working-dir-dialog"
68 #define IPREFS_WORKING_DIR_URI "icommand-working-dir-uri"
70 /* a data set in the LegendDialog GObject
72 #define ICOMMAND_TAB_LEGEND_VISIBLE "nact-icommand-tab-legend-dialog-visible"
73 #define ICOMMAND_TAB_STATUSBAR_CONTEXT "nact-icommand-tab-statusbar-context"
75 static gboolean st_initialized = FALSE;
76 static gboolean st_finalized = FALSE;
77 static gboolean st_on_selection_change = FALSE;
78 static NATokens *st_tokens = NULL;
80 static GType register_type( void );
81 static void interface_base_init( NactICommandTabInterface *klass );
82 static void interface_base_finalize( NactICommandTabInterface *klass );
84 static void on_iactions_list_column_edited( NactICommandTab *instance, NAObject *object, gchar *text, gint column );
85 static void on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected );
87 static GtkWidget *get_label_entry( NactICommandTab *instance );
88 static GtkButton *get_legend_button( NactICommandTab *instance );
89 static GtkWindow *get_legend_dialog( NactICommandTab *instance );
90 static GtkWidget *get_parameters_entry( NactICommandTab *instance );
91 static GtkButton *get_path_button( NactICommandTab *instance );
92 static GtkWidget *get_path_entry( NactICommandTab *instance );
93 static void legend_dialog_show( NactICommandTab *instance );
94 static void legend_dialog_hide( NactICommandTab *instance );
95 static void on_label_changed( GtkEntry *entry, NactICommandTab *instance );
96 static void on_legend_clicked( GtkButton *button, NactICommandTab *instance );
97 static gboolean on_legend_dialog_deleted( GtkWidget *dialog, GdkEvent *event, NactICommandTab *instance );
98 static void on_parameters_changed( GtkEntry *entry, NactICommandTab *instance );
99 static void on_path_browse( GtkButton *button, NactICommandTab *instance );
100 static void on_path_changed( GtkEntry *entry, NactICommandTab *instance );
101 static void on_wdir_browse( GtkButton *button, NactICommandTab *instance );
102 static void on_wdir_changed( GtkEntry *entry, NactICommandTab *instance );
103 static gchar *parse_parameters( NactICommandTab *instance );
104 static void update_example_label( NactICommandTab *instance, NAObjectProfile *profile );
106 GType
107 nact_icommand_tab_get_type( void )
109 static GType iface_type = 0;
111 if( !iface_type ){
112 iface_type = register_type();
115 return( iface_type );
118 static GType
119 register_type( void )
121 static const gchar *thisfn = "nact_icommand_tab_register_type";
122 GType type;
124 static const GTypeInfo info = {
125 sizeof( NactICommandTabInterface ),
126 ( GBaseInitFunc ) interface_base_init,
127 ( GBaseFinalizeFunc ) interface_base_finalize,
128 NULL,
129 NULL,
130 NULL,
133 NULL
136 g_debug( "%s", thisfn );
138 type = g_type_register_static( G_TYPE_INTERFACE, "NactICommandTab", &info, 0 );
140 g_type_interface_add_prerequisite( type, BASE_WINDOW_TYPE );
142 return( type );
145 static void
146 interface_base_init( NactICommandTabInterface *klass )
148 static const gchar *thisfn = "nact_icommand_tab_interface_base_init";
150 if( !st_initialized ){
152 g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
154 klass->private = g_new0( NactICommandTabInterfacePrivate, 1 );
156 st_initialized = TRUE;
160 static void
161 interface_base_finalize( NactICommandTabInterface *klass )
163 static const gchar *thisfn = "nact_icommand_tab_interface_base_finalize";
165 if( st_initialized && !st_finalized ){
167 g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
169 st_finalized = TRUE;
171 g_free( klass->private );
176 * nact_icommand_tab_initial_load:
177 * @window: this #NactICommandTab instance.
179 * Initializes the tab widget at initial load.
181 * The GConf preference keys used in this tab were misnamed from v1.11.1
182 * up to and including v1.12.0. Starting with v1.12.1, these are migrated
183 * here, so that the normal code only makes use of 'good' keys.
185 void
186 nact_icommand_tab_initial_load_toplevel( NactICommandTab *instance )
188 static const gchar *thisfn = "nact_icommand_tab_initial_load_toplevel";
190 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
192 if( st_initialized && !st_finalized ){
194 g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
196 nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-legend-dialog", IPREFS_LEGEND_DIALOG );
197 nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-command-chooser", IPREFS_COMMAND_CHOOSER );
198 nact_iprefs_migrate_key( BASE_WINDOW( instance ), "iconditions-folder-uri", IPREFS_FOLDER_URI );
203 * nact_icommand_tab_runtime_init:
204 * @window: this #NactICommandTab instance.
206 * Initializes the tab widget at each time the widget will be displayed.
207 * Connect signals and setup runtime values.
209 void
210 nact_icommand_tab_runtime_init_toplevel( NactICommandTab *instance )
212 static const gchar *thisfn = "nact_icommand_tab_runtime_init_toplevel";
213 GtkWindow *legend_dialog;
214 GtkWidget *label_entry, *path_entry, *parameters_entry, *wdir_entry;
215 GtkButton *path_button, *legend_button, *wdir_button;
217 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
219 if( st_initialized && !st_finalized ){
221 g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
223 label_entry = get_label_entry( instance );
224 base_window_signal_connect(
225 BASE_WINDOW( instance ),
226 G_OBJECT( label_entry ),
227 "changed",
228 G_CALLBACK( on_label_changed ));
230 path_entry = get_path_entry( instance );
231 base_window_signal_connect(
232 BASE_WINDOW( instance ),
233 G_OBJECT( path_entry ),
234 "changed",
235 G_CALLBACK( on_path_changed ));
237 path_button = get_path_button( instance );
238 base_window_signal_connect(
239 BASE_WINDOW( instance ),
240 G_OBJECT( path_button ),
241 "clicked",
242 G_CALLBACK( on_path_browse ));
244 parameters_entry = get_parameters_entry( instance );
245 base_window_signal_connect(
246 BASE_WINDOW( instance ),
247 G_OBJECT( parameters_entry ),
248 "changed",
249 G_CALLBACK( on_parameters_changed ));
251 legend_button = get_legend_button( instance );
252 base_window_signal_connect(
253 BASE_WINDOW( instance ),
254 G_OBJECT( legend_button ),
255 "clicked",
256 G_CALLBACK( on_legend_clicked ));
258 legend_dialog = get_legend_dialog( instance );
259 base_window_signal_connect(
260 BASE_WINDOW( instance ),
261 G_OBJECT( legend_dialog ),
262 "delete-event",
263 G_CALLBACK( on_legend_dialog_deleted ));
265 wdir_entry = base_window_get_widget( BASE_WINDOW( instance ), "WorkingDirectoryEntry" );
266 base_window_signal_connect(
267 BASE_WINDOW( instance ),
268 G_OBJECT( wdir_entry ),
269 "changed",
270 G_CALLBACK( on_wdir_changed ));
272 wdir_button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "CommandWorkingDirectoryButton" ));
273 base_window_signal_connect(
274 BASE_WINDOW( instance ),
275 G_OBJECT( wdir_button ),
276 "clicked",
277 G_CALLBACK( on_wdir_browse ));
279 base_window_signal_connect(
280 BASE_WINDOW( instance ),
281 G_OBJECT( instance ),
282 MAIN_WINDOW_SIGNAL_SELECTION_CHANGED,
283 G_CALLBACK( on_tab_updatable_selection_changed ));
285 base_window_signal_connect(
286 BASE_WINDOW( instance ),
287 G_OBJECT( instance ),
288 IACTIONS_LIST_SIGNAL_COLUMN_EDITED,
289 G_CALLBACK( on_iactions_list_column_edited ));
291 /* allocate a static fake NATokens object which will be user to build
292 * the example label - this object will be unreffed on dispose
294 if( !st_tokens ){
295 st_tokens = na_tokens_new_for_example();
300 void
301 nact_icommand_tab_all_widgets_showed( NactICommandTab *instance )
303 static const gchar *thisfn = "nact_icommand_tab_all_widgets_showed";
305 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
307 if( st_initialized && !st_finalized ){
309 g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
314 * nact_icommand_tab_dispose:
315 * @window: this #NactICommandTab instance.
317 * Called at instance_dispose time.
319 void
320 nact_icommand_tab_dispose( NactICommandTab *instance )
322 static const gchar *thisfn = "nact_icommand_tab_dispose";
324 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
326 if( st_initialized && !st_finalized ){
328 g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
330 legend_dialog_hide( instance );
332 if( st_tokens ){
333 g_object_unref( st_tokens );
338 static void
339 on_iactions_list_column_edited( NactICommandTab *instance, NAObject *object, gchar *text, gint column )
341 GtkWidget *label_widget;
343 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
345 if( st_initialized && !st_finalized ){
347 if( NA_IS_OBJECT_PROFILE( object )){
348 label_widget = get_label_entry( instance );
349 gtk_entry_set_text( GTK_ENTRY( label_widget ), text );
354 static void
355 on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_selected )
357 static const gchar *thisfn = "nact_icommand_tab_on_tab_updatable_selection_changed";
358 NAObjectProfile *profile;
359 gboolean editable;
360 gboolean enable_tab;
361 GtkWidget *label_entry, *path_entry, *parameters_entry, *wdir_entry;
362 gchar *label, *path, *parameters, *wdir;
363 GtkButton *path_button, *wdir_button;
364 GtkButton *legend_button;
366 g_return_if_fail( NACT_IS_ICOMMAND_TAB( instance ));
368 if( st_initialized && !st_finalized ){
370 g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
372 g_object_get(
373 G_OBJECT( instance ),
374 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
375 TAB_UPDATABLE_PROP_EDITABLE, &editable,
376 NULL );
378 enable_tab = ( profile != NULL );
379 nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_COMMAND, enable_tab );
381 st_on_selection_change = TRUE;
383 label_entry = get_label_entry( instance );
384 label = profile ? na_object_get_label( profile ) : g_strdup( "" );
385 label = label ? label : g_strdup( "" );
386 gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
387 g_free( label );
388 gtk_widget_set_sensitive( label_entry, profile != NULL );
389 nact_gtk_utils_set_editable( G_OBJECT( label_entry ), editable );
391 path_entry = get_path_entry( instance );
392 path = profile ? na_object_get_path( profile ) : g_strdup( "" );
393 path = path ? path : g_strdup( "" );
394 gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
395 g_free( path );
396 gtk_widget_set_sensitive( path_entry, profile != NULL );
397 nact_gtk_utils_set_editable( G_OBJECT( path_entry ), editable );
399 path_button = get_path_button( instance );
400 gtk_widget_set_sensitive( GTK_WIDGET( path_button ), profile != NULL );
401 nact_gtk_utils_set_editable( G_OBJECT( path_button ), editable );
403 parameters_entry = get_parameters_entry( instance );
404 parameters = profile ? na_object_get_parameters( profile ) : g_strdup( "" );
405 parameters = parameters ? parameters : g_strdup( "" );
406 gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
407 g_free( parameters );
408 gtk_widget_set_sensitive( parameters_entry, profile != NULL );
409 nact_gtk_utils_set_editable( G_OBJECT( parameters_entry ), editable );
411 legend_button = get_legend_button( instance );
412 gtk_widget_set_sensitive( GTK_WIDGET( legend_button ), profile != NULL );
414 update_example_label( instance, profile );
416 wdir_entry = base_window_get_widget( BASE_WINDOW( instance ), "WorkingDirectoryEntry" );
417 wdir = profile ? na_object_get_working_dir( profile ) : g_strdup( "" );
418 wdir = wdir ? wdir : g_strdup( "" );
419 gtk_entry_set_text( GTK_ENTRY( wdir_entry ), wdir );
420 g_free( wdir );
421 gtk_widget_set_sensitive( wdir_entry, profile != NULL );
422 nact_gtk_utils_set_editable( G_OBJECT( wdir_entry ), editable );
424 wdir_button = GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "CommandWorkingDirectoryButton" ));
425 gtk_widget_set_sensitive( GTK_WIDGET( wdir_button ), profile != NULL );
426 nact_gtk_utils_set_editable( G_OBJECT( wdir_button ), editable );
428 st_on_selection_change = FALSE;
432 static GtkWidget *
433 get_label_entry( NactICommandTab *instance )
435 return( base_window_get_widget( BASE_WINDOW( instance ), "ProfileLabelEntry" ));
438 static GtkButton *
439 get_legend_button( NactICommandTab *instance )
441 return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "CommandLegendButton" )));
444 static GtkWindow *
445 get_legend_dialog( NactICommandTab *instance )
447 return( base_window_get_named_toplevel( BASE_WINDOW( instance ), "LegendDialog" ));
450 static GtkWidget *
451 get_parameters_entry( NactICommandTab *instance )
453 return( base_window_get_widget( BASE_WINDOW( instance ), "CommandParametersEntry" ));
456 static GtkButton *
457 get_path_button( NactICommandTab *instance )
459 return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "CommandPathButton" )));
462 static GtkWidget *
463 get_path_entry( NactICommandTab *instance )
465 return( base_window_get_widget( BASE_WINDOW( instance ), "CommandPathEntry" ));
468 static void
469 legend_dialog_hide( NactICommandTab *instance )
471 GtkWindow *legend_dialog;
472 GtkButton *legend_button;
473 gboolean is_visible;
475 legend_dialog = get_legend_dialog( instance );
476 is_visible = ( gboolean ) GPOINTER_TO_INT(
477 g_object_get_data( G_OBJECT( legend_dialog ), ICOMMAND_TAB_LEGEND_VISIBLE ));
479 if( is_visible ){
480 g_return_if_fail( GTK_IS_WINDOW( legend_dialog ));
481 base_iprefs_save_named_window_position( BASE_WINDOW( instance ), legend_dialog, IPREFS_LEGEND_DIALOG );
482 gtk_widget_hide( GTK_WIDGET( legend_dialog ));
484 /* set the legend button state consistent for when the dialog is
485 * hidden by another way (eg. close the edit profile dialog)
487 legend_button = get_legend_button( instance );
488 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( legend_button ), FALSE );
490 g_object_set_data( G_OBJECT( legend_dialog ), ICOMMAND_TAB_LEGEND_VISIBLE, GINT_TO_POINTER( FALSE ));
494 static void
495 legend_dialog_show( NactICommandTab *instance )
497 GtkWindow *legend_dialog;
498 GtkWindow *toplevel;
500 legend_dialog = get_legend_dialog( instance );
501 gtk_window_set_deletable( legend_dialog, FALSE );
503 toplevel = base_window_get_toplevel( BASE_WINDOW( instance ));
504 gtk_window_set_transient_for( GTK_WINDOW( legend_dialog ), toplevel );
506 base_iprefs_position_named_window( BASE_WINDOW( instance ), legend_dialog, IPREFS_LEGEND_DIALOG );
507 gtk_widget_show( GTK_WIDGET( legend_dialog ));
509 g_object_set_data( G_OBJECT( legend_dialog ), ICOMMAND_TAB_LEGEND_VISIBLE, GINT_TO_POINTER( TRUE ));
512 static void
513 on_label_changed( GtkEntry *entry, NactICommandTab *instance )
515 NAObjectProfile *profile;
516 const gchar *label;
518 if( !st_on_selection_change ){
519 g_object_get(
520 G_OBJECT( instance ),
521 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
522 NULL );
524 if( profile ){
525 label = gtk_entry_get_text( entry );
526 na_object_set_label( profile, label );
527 g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, TRUE );
532 static void
533 on_legend_clicked( GtkButton *button, NactICommandTab *instance )
535 if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
536 legend_dialog_show( instance );
538 } else {
539 legend_dialog_hide( instance );
543 static gboolean
544 on_legend_dialog_deleted( GtkWidget *dialog, GdkEvent *event, NactICommandTab *instance )
546 /*g_debug( "on_legend_dialog_deleted" );*/
547 legend_dialog_hide( instance );
548 return( TRUE );
551 static void
552 on_parameters_changed( GtkEntry *entry, NactICommandTab *instance )
554 NAObjectProfile *profile;
556 if( !st_on_selection_change ){
557 g_object_get(
558 G_OBJECT( instance ),
559 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
560 NULL );
562 if( profile ){
563 na_object_set_parameters( profile, gtk_entry_get_text( entry ));
564 g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
565 update_example_label( instance, profile );
570 static void
571 on_path_browse( GtkButton *button, NactICommandTab *instance )
573 nact_gtk_utils_select_file(
574 BASE_WINDOW( instance ),
575 _( "Choosing a command" ), IPREFS_COMMAND_CHOOSER,
576 get_path_entry( instance ), IPREFS_FOLDER_URI, "file:///bin" );
579 static void
580 on_path_changed( GtkEntry *entry, NactICommandTab *instance )
582 NAObjectProfile *profile;
584 if( !st_on_selection_change ){
585 g_object_get(
586 G_OBJECT( instance ),
587 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
588 NULL );
590 if( profile ){
591 na_object_set_path( profile, gtk_entry_get_text( entry ));
592 g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
593 update_example_label( instance, profile );
598 static void
599 on_wdir_browse( GtkButton *button, NactICommandTab *instance )
601 GtkWidget *wdir_entry;
602 NAObjectProfile *profile;
603 gchar *default_value;
605 g_object_get(
606 G_OBJECT( instance ),
607 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
608 NULL );
610 if( profile ){
611 default_value = na_factory_object_get_default( NA_IFACTORY_OBJECT( profile ), NAFO_DATA_WORKING_DIR );
612 wdir_entry = base_window_get_widget( BASE_WINDOW( instance ), "WorkingDirectoryEntry" );
614 nact_gtk_utils_select_dir(
615 BASE_WINDOW( instance ),
616 _( "Choosing a working directory" ), IPREFS_WORKING_DIR_DIALOG,
617 wdir_entry, IPREFS_WORKING_DIR_URI, default_value );
619 g_free( default_value );
623 static void
624 on_wdir_changed( GtkEntry *entry, NactICommandTab *instance )
626 NAObjectProfile *profile;
628 if( !st_on_selection_change ){
629 g_object_get(
630 G_OBJECT( instance ),
631 TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
632 NULL );
634 if( profile ){
635 na_object_set_working_dir( profile, gtk_entry_get_text( entry ));
636 g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, profile, FALSE );
642 * See core/na-tokens.c for valid parameters
644 static gchar *
645 parse_parameters( NactICommandTab *instance )
647 const gchar *command = gtk_entry_get_text( GTK_ENTRY( get_path_entry( instance )));
648 const gchar *param_template = gtk_entry_get_text( GTK_ENTRY( get_parameters_entry( instance )));
649 gchar *exec, *returned;
651 exec = g_strdup_printf( "%s %s", command, param_template );
652 returned = na_tokens_parse_parameters( st_tokens, exec, FALSE );
653 g_free( exec );
655 return( returned );
658 static void
659 update_example_label( NactICommandTab *instance, NAObjectProfile *profile )
661 /*static const char *thisfn = "nact_iconditions_update_example_label";*/
662 gchar *newlabel;
663 gchar *parameters;
664 GtkWidget *example_widget;
666 example_widget = base_window_get_widget( BASE_WINDOW( instance ), "CommandExampleLabel" );
668 if( profile ){
669 parameters = parse_parameters( instance );
670 /*g_debug( "%s: parameters=%s", thisfn, parameters );*/
672 /* convert special xml chars (&, <, >,...) to avoid warnings
673 * generated by Pango parser
675 /* i18n: command-line example: Ex.: /bin/ls file1.txt file2.txt */
676 newlabel = g_markup_printf_escaped(
677 "<i><b><span size=\"small\">%s %s</span></b></i>", _( "Ex.:" ), parameters );
679 g_free( parameters );
681 } else {
682 newlabel = g_strdup( "" );
685 gtk_label_set_label( GTK_LABEL( example_widget ), newlabel );
686 g_free( newlabel );