A few cleanup tweaks inspired by debugging session

with Darin.

	* libnautilus-extensions/nautilus-program-choosing.h,
	* libnautilus-extensions/nautilus-program-choosing.c:
	(nautilus_choose_application_for_file): Make callback
	take a const char * instead of a char *.
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_chose_application_callback): take
	a const char * instead of a char *.
	* src/ntl-index-panel.c:
	(nautilus_index_panel_chose_application_callback):
	take a const char * instead of a char *.
	(open_with_callback): unref file
	(add_command_buttons): Use gtk_signal_connect instead of
	nautilus_gtk_signal_connect_free_data when passing NULL
	as the data (Doh!).
This commit is contained in:
John Sullivan 2000-05-24 00:14:21 +00:00
parent 04bcb0220e
commit e4d87678ec
9 changed files with 46 additions and 26 deletions

View file

@ -1,3 +1,23 @@
2000-05-23 John Sullivan <sullivan@eazel.com>
A few cleanup tweaks inspired by debugging session
with Darin.
* libnautilus-extensions/nautilus-program-choosing.h,
* libnautilus-extensions/nautilus-program-choosing.c:
(nautilus_choose_application_for_file): Make callback
take a const char * instead of a char *.
* src/file-manager/fm-directory-view.c:
(fm_directory_view_chose_application_callback): take
a const char * instead of a char *.
* src/ntl-index-panel.c:
(nautilus_index_panel_chose_application_callback):
take a const char * instead of a char *.
(open_with_callback): unref file
(add_command_buttons): Use gtk_signal_connect instead of
nautilus_gtk_signal_connect_free_data when passing NULL
as the data (Doh!).
2000-05-23 Andy Hertzfeld <andy@eazel.com>
* libnautilus-extensions/nautilus-icon-canvas-item.c:

View file

@ -143,7 +143,10 @@ nautilus_choose_application_for_file (NautilusFile *file,
if (gnome_dialog_run (dialog) == GNOME_OK) {
/* FIXME: Need to extract result from dialog! */
#ifdef TESTING_LAUNCH
command_string = g_strdup ("gnotepad");
/* FIXME: investigate why passing wrong text here ("gnotepad")
* causes an X error.
*/
command_string = "gnp";
#else
command_string = NULL;
#endif
@ -152,7 +155,6 @@ nautilus_choose_application_for_file (NautilusFile *file,
}
gtk_widget_destroy (GTK_WIDGET (dialog));
/* Call callback even if identifier is NULL, so caller can
* free callback_data if necessary and present some cancel
* UI if desired.

View file

@ -33,7 +33,7 @@
typedef void (*NautilusComponentChoiceCallback) (NautilusViewIdentifier *identifier,
gpointer callback_data);
typedef void (*NautilusApplicationChoiceCallback) (char *command_string,
typedef void (*NautilusApplicationChoiceCallback) (const char *command_string,
gpointer callback_data);
void nautilus_choose_application_for_file (NautilusFile *file,

View file

@ -143,7 +143,10 @@ nautilus_choose_application_for_file (NautilusFile *file,
if (gnome_dialog_run (dialog) == GNOME_OK) {
/* FIXME: Need to extract result from dialog! */
#ifdef TESTING_LAUNCH
command_string = g_strdup ("gnotepad");
/* FIXME: investigate why passing wrong text here ("gnotepad")
* causes an X error.
*/
command_string = "gnp";
#else
command_string = NULL;
#endif
@ -152,7 +155,6 @@ nautilus_choose_application_for_file (NautilusFile *file,
}
gtk_widget_destroy (GTK_WIDGET (dialog));
/* Call callback even if identifier is NULL, so caller can
* free callback_data if necessary and present some cancel
* UI if desired.

View file

@ -33,7 +33,7 @@
typedef void (*NautilusComponentChoiceCallback) (NautilusViewIdentifier *identifier,
gpointer callback_data);
typedef void (*NautilusApplicationChoiceCallback) (char *command_string,
typedef void (*NautilusApplicationChoiceCallback) (const char *command_string,
gpointer callback_data);
void nautilus_choose_application_for_file (NautilusFile *file,

View file

@ -313,7 +313,7 @@ bonobo_menu_open_in_new_window_callback (BonoboUIHandler *ui_handler, gpointer u
}
static void
fm_directory_view_chose_application_callback (char *command_string,
fm_directory_view_chose_application_callback (const char *command_string,
gpointer callback_data)
{
NautilusFile *file;
@ -330,7 +330,6 @@ fm_directory_view_chose_application_callback (char *command_string,
}
nautilus_file_unref (file);
g_free (command_string);
}
static void

View file

@ -698,7 +698,7 @@ command_button_callback (GtkWidget *button, char *command_str)
}
static void
nautilus_index_panel_chose_application_callback (char *command_string,
nautilus_index_panel_chose_application_callback (const char *command_string,
gpointer callback_data)
{
g_assert (NAUTILUS_IS_INDEX_PANEL (callback_data));
@ -708,8 +708,6 @@ nautilus_index_panel_chose_application_callback (char *command_string,
(command_string,
NAUTILUS_INDEX_PANEL (callback_data)->details->uri);
}
g_free (command_string);
}
static void
@ -728,7 +726,8 @@ open_with_callback (GtkWidget *button, gpointer ignored)
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (index_panel))),
nautilus_index_panel_chose_application_callback,
index_panel);
nautilus_file_unref (file);
}
/* utility routine that allocates the command buttons from the command list */
@ -772,12 +771,12 @@ add_command_buttons (NautilusIndexPanel *index_panel, GList *command_list)
/* Catch-all button after all the others. */
temp_button = gtk_button_new_with_label (_("Open with ..."));
nautilus_gtk_signal_connect_free_data
gtk_signal_connect
(GTK_OBJECT (temp_button),
"clicked",
open_with_callback,
NULL);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_widget_show (temp_button);
gtk_box_pack_start (GTK_BOX (index_panel->details->button_box),
temp_button,

View file

@ -698,7 +698,7 @@ command_button_callback (GtkWidget *button, char *command_str)
}
static void
nautilus_index_panel_chose_application_callback (char *command_string,
nautilus_index_panel_chose_application_callback (const char *command_string,
gpointer callback_data)
{
g_assert (NAUTILUS_IS_INDEX_PANEL (callback_data));
@ -708,8 +708,6 @@ nautilus_index_panel_chose_application_callback (char *command_string,
(command_string,
NAUTILUS_INDEX_PANEL (callback_data)->details->uri);
}
g_free (command_string);
}
static void
@ -728,7 +726,8 @@ open_with_callback (GtkWidget *button, gpointer ignored)
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (index_panel))),
nautilus_index_panel_chose_application_callback,
index_panel);
nautilus_file_unref (file);
}
/* utility routine that allocates the command buttons from the command list */
@ -772,12 +771,12 @@ add_command_buttons (NautilusIndexPanel *index_panel, GList *command_list)
/* Catch-all button after all the others. */
temp_button = gtk_button_new_with_label (_("Open with ..."));
nautilus_gtk_signal_connect_free_data
gtk_signal_connect
(GTK_OBJECT (temp_button),
"clicked",
open_with_callback,
NULL);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_widget_show (temp_button);
gtk_box_pack_start (GTK_BOX (index_panel->details->button_box),
temp_button,

View file

@ -698,7 +698,7 @@ command_button_callback (GtkWidget *button, char *command_str)
}
static void
nautilus_index_panel_chose_application_callback (char *command_string,
nautilus_index_panel_chose_application_callback (const char *command_string,
gpointer callback_data)
{
g_assert (NAUTILUS_IS_INDEX_PANEL (callback_data));
@ -708,8 +708,6 @@ nautilus_index_panel_chose_application_callback (char *command_string,
(command_string,
NAUTILUS_INDEX_PANEL (callback_data)->details->uri);
}
g_free (command_string);
}
static void
@ -728,7 +726,8 @@ open_with_callback (GtkWidget *button, gpointer ignored)
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (index_panel))),
nautilus_index_panel_chose_application_callback,
index_panel);
nautilus_file_unref (file);
}
/* utility routine that allocates the command buttons from the command list */
@ -772,12 +771,12 @@ add_command_buttons (NautilusIndexPanel *index_panel, GList *command_list)
/* Catch-all button after all the others. */
temp_button = gtk_button_new_with_label (_("Open with ..."));
nautilus_gtk_signal_connect_free_data
gtk_signal_connect
(GTK_OBJECT (temp_button),
"clicked",
open_with_callback,
NULL);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_object_set_user_data (GTK_OBJECT (temp_button), index_panel);
gtk_widget_show (temp_button);
gtk_box_pack_start (GTK_BOX (index_panel->details->button_box),
temp_button,