summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2000-05-24 00:14:21 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2000-05-24 00:14:21 +0000
commite4d87678ec89e87966b4f807d109ccf8583a7b46 (patch)
tree739ae072a4e1761526373878ac79956494338173
parent04bcb0220e1219023cf3e77263f6c2390b90501c (diff)
downloadnautilus-e4d87678ec89e87966b4f807d109ccf8583a7b46.tar.gz
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!).
-rw-r--r--ChangeLog20
-rw-r--r--libnautilus-extensions/nautilus-program-choosing.c6
-rw-r--r--libnautilus-extensions/nautilus-program-choosing.h2
-rw-r--r--libnautilus-private/nautilus-program-choosing.c6
-rw-r--r--libnautilus-private/nautilus-program-choosing.h2
-rw-r--r--src/file-manager/fm-directory-view.c3
-rw-r--r--src/nautilus-information-panel.c11
-rw-r--r--src/nautilus-sidebar.c11
-rw-r--r--src/ntl-index-panel.c11
9 files changed, 46 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index d604f8b37..9b6351afe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/libnautilus-extensions/nautilus-program-choosing.c b/libnautilus-extensions/nautilus-program-choosing.c
index 38a804f4d..fc5ae7a26 100644
--- a/libnautilus-extensions/nautilus-program-choosing.c
+++ b/libnautilus-extensions/nautilus-program-choosing.c
@@ -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.
diff --git a/libnautilus-extensions/nautilus-program-choosing.h b/libnautilus-extensions/nautilus-program-choosing.h
index e8f4d6664..bf579ff7f 100644
--- a/libnautilus-extensions/nautilus-program-choosing.h
+++ b/libnautilus-extensions/nautilus-program-choosing.h
@@ -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,
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index 38a804f4d..fc5ae7a26 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -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.
diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h
index e8f4d6664..bf579ff7f 100644
--- a/libnautilus-private/nautilus-program-choosing.h
+++ b/libnautilus-private/nautilus-program-choosing.h
@@ -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,
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index d73e641e3..408331a9c 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -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
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index d7702e604..eff0f144d 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -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,
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index d7702e604..eff0f144d 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -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,
diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c
index d7702e604..eff0f144d 100644
--- a/src/ntl-index-panel.c
+++ b/src/ntl-index-panel.c
@@ -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,