summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Z. Ragan <gzr@eazel.com>2001-02-06 03:05:29 +0000
committerGene Ragan <gzr@src.gnome.org>2001-02-06 03:05:29 +0000
commitca6019ecc662e94b21c77004e3e8a68da6b1e3f4 (patch)
tree12865f415a06d129ca1b38c0f2fca709cf2086b8
parentf80a08a4edf20d87d68ce1c1648280969b0842a3 (diff)
downloadnautilus-ca6019ecc662e94b21c77004e3e8a68da6b1e3f4.tar.gz
Add code to send the mime type of the file being examined to the mime type
2001-02-05 Gene Z. Ragan <gzr@eazel.com> Add code to send the mime type of the file being examined to the mime type capplet so that the capplet can scroll to the mime type being examined. * libnautilus-extensions/nautilus-program-chooser.c: (repopulate_program_list), (launch_mime_capplet), (launch_mime_capplet_and_close_dialog), (nautilus_program_chooser_show_no_choices_message):
-rw-r--r--ChangeLog11
-rw-r--r--libnautilus-extensions/nautilus-program-chooser.c31
-rw-r--r--libnautilus-private/nautilus-program-chooser.c31
3 files changed, 57 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cbcec765..7b7cdbb86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-02-05 Gene Z. Ragan <gzr@eazel.com>
+
+ Add code to send the mime type of the file being examined to the
+ mime type capplet so that the capplet can scroll to the mime type
+ being examined.
+
+ * libnautilus-extensions/nautilus-program-chooser.c:
+ (repopulate_program_list), (launch_mime_capplet),
+ (launch_mime_capplet_and_close_dialog),
+ (nautilus_program_chooser_show_no_choices_message):
+
2001-02-05 John Sullivan <sullivan@eazel.com>
reviewed by: Pavel Cisler <pavel@eazel.com>
diff --git a/libnautilus-extensions/nautilus-program-chooser.c b/libnautilus-extensions/nautilus-program-chooser.c
index e69e96ee4..0de6bd913 100644
--- a/libnautilus-extensions/nautilus-program-chooser.c
+++ b/libnautilus-extensions/nautilus-program-chooser.c
@@ -89,6 +89,9 @@ typedef struct {
*/
#define NAME_COLUMN_INITIAL_WIDTH 200
+/* Progamr name of the mime type capplet */
+#define MIME_TYPE_CAPPLET_NAME "nautilus-mime-type-capplet"
+
/* Forward declarations as needed */
static gboolean program_file_pair_is_default_for_file_type (ProgramFilePair *pair);
static gboolean program_file_pair_is_default_for_file (ProgramFilePair *pair);
@@ -358,9 +361,6 @@ repopulate_program_list (GnomeDialog *program_chooser,
}
gtk_clist_sort (clist);
-
- /* Start with first item selected, rather than some arbitrary item */
- gtk_clist_select_row (clist, 0, 0);
}
static NautilusFile *
@@ -892,25 +892,40 @@ set_default_for_item (ProgramFilePair *pair)
}
static void
-launch_mime_capplet (GtkWidget *button, gpointer ignored)
+launch_mime_capplet (GtkWidget *button, gpointer callback_data)
{
+ char *command;
+
g_assert (GTK_IS_WIDGET (button));
-
- nautilus_launch_application_from_command ("nautilus-mime-type-capplet", NULL, FALSE);
+
+ command = g_strdup_printf ("%s %s", MIME_TYPE_CAPPLET_NAME, (char *)callback_data);
+
+ nautilus_launch_application_from_command (command, NULL, FALSE);
+
+ g_free (command);
}
static void
launch_mime_capplet_and_close_dialog (GtkWidget *button, gpointer callback_data)
{
+ ProgramFilePair *file_pair;
+ char *mime_type;
+
g_assert (GTK_IS_WIDGET (button));
g_assert (GNOME_IS_DIALOG (callback_data));
- launch_mime_capplet (button, callback_data);
+ file_pair = get_selected_program_file_pair (GNOME_DIALOG (callback_data));
+
+ mime_type = nautilus_file_get_mime_type (file_pair->file);
+
+ launch_mime_capplet (button, mime_type);
/* Don't leave a nested modal dialogs in the wake of switching
* user's attention to the capplet.
*/
gnome_dialog_close (GNOME_DIALOG (callback_data));
+
+ g_free (mime_type);
}
static void
@@ -1461,7 +1476,7 @@ nautilus_program_chooser_show_no_choices_message (GnomeVFSMimeActionType action_
dialog = nautilus_show_yes_no_dialog
(prompt, dialog_title, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, parent_window);
- gnome_dialog_button_connect (dialog, GNOME_OK, launch_mime_capplet, NULL);
+ gnome_dialog_button_connect (dialog, GNOME_OK, launch_mime_capplet, nautilus_file_get_mime_type (file));
g_free (unavailable_message);
g_free (file_name);
diff --git a/libnautilus-private/nautilus-program-chooser.c b/libnautilus-private/nautilus-program-chooser.c
index e69e96ee4..0de6bd913 100644
--- a/libnautilus-private/nautilus-program-chooser.c
+++ b/libnautilus-private/nautilus-program-chooser.c
@@ -89,6 +89,9 @@ typedef struct {
*/
#define NAME_COLUMN_INITIAL_WIDTH 200
+/* Progamr name of the mime type capplet */
+#define MIME_TYPE_CAPPLET_NAME "nautilus-mime-type-capplet"
+
/* Forward declarations as needed */
static gboolean program_file_pair_is_default_for_file_type (ProgramFilePair *pair);
static gboolean program_file_pair_is_default_for_file (ProgramFilePair *pair);
@@ -358,9 +361,6 @@ repopulate_program_list (GnomeDialog *program_chooser,
}
gtk_clist_sort (clist);
-
- /* Start with first item selected, rather than some arbitrary item */
- gtk_clist_select_row (clist, 0, 0);
}
static NautilusFile *
@@ -892,25 +892,40 @@ set_default_for_item (ProgramFilePair *pair)
}
static void
-launch_mime_capplet (GtkWidget *button, gpointer ignored)
+launch_mime_capplet (GtkWidget *button, gpointer callback_data)
{
+ char *command;
+
g_assert (GTK_IS_WIDGET (button));
-
- nautilus_launch_application_from_command ("nautilus-mime-type-capplet", NULL, FALSE);
+
+ command = g_strdup_printf ("%s %s", MIME_TYPE_CAPPLET_NAME, (char *)callback_data);
+
+ nautilus_launch_application_from_command (command, NULL, FALSE);
+
+ g_free (command);
}
static void
launch_mime_capplet_and_close_dialog (GtkWidget *button, gpointer callback_data)
{
+ ProgramFilePair *file_pair;
+ char *mime_type;
+
g_assert (GTK_IS_WIDGET (button));
g_assert (GNOME_IS_DIALOG (callback_data));
- launch_mime_capplet (button, callback_data);
+ file_pair = get_selected_program_file_pair (GNOME_DIALOG (callback_data));
+
+ mime_type = nautilus_file_get_mime_type (file_pair->file);
+
+ launch_mime_capplet (button, mime_type);
/* Don't leave a nested modal dialogs in the wake of switching
* user's attention to the capplet.
*/
gnome_dialog_close (GNOME_DIALOG (callback_data));
+
+ g_free (mime_type);
}
static void
@@ -1461,7 +1476,7 @@ nautilus_program_chooser_show_no_choices_message (GnomeVFSMimeActionType action_
dialog = nautilus_show_yes_no_dialog
(prompt, dialog_title, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, parent_window);
- gnome_dialog_button_connect (dialog, GNOME_OK, launch_mime_capplet, NULL);
+ gnome_dialog_button_connect (dialog, GNOME_OK, launch_mime_capplet, nautilus_file_get_mime_type (file));
g_free (unavailable_message);
g_free (file_name);