New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
|
|
|
|
|
|
|
/* nautilus-mime-type-capplet-dialog.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000 Eazel, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Authors: Jonathan Blandford <jrb@redhat.com>
|
|
|
|
* Gene Z. Ragan <gzr@eazel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2000-12-08 23:36:43 +00:00
|
|
|
#include <ctype.h>
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
#include <gnome.h>
|
|
|
|
#include <gtk/gtk.h>
|
2000-11-20 02:31:25 +00:00
|
|
|
#include <gtk/gtklist.h>
|
|
|
|
#include <gtk/gtkbin.h>
|
|
|
|
#include <gtk/gtklistitem.h>
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
2000-08-09 06:23:46 +00:00
|
|
|
#include <libgnomevfs/gnome-vfs-application-registry.h>
|
2001-03-06 23:33:19 +00:00
|
|
|
#include <libgnomevfs/gnome-vfs-utils.h>
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
#include "libuuid/uuid.h"
|
2001-07-12 17:01:14 +00:00
|
|
|
#include "file-types-capplet.h"
|
|
|
|
#include "file-types-capplet-dialogs.h"
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
|
|
|
/* gtk_window_set_default_width (and some other functions) use a
|
|
|
|
* magic undocumented number of -2 to mean "ignore this parameter".
|
|
|
|
*/
|
|
|
|
#define NO_DEFAULT_MAGIC_NUMBER -2
|
|
|
|
|
|
|
|
/* Scrolling list has no idea how tall to make itself. Its
|
|
|
|
* "natural height" is just enough to draw the scroll bar controls.
|
|
|
|
* Hardwire an initial window size here, but let user resize
|
|
|
|
* bigger or smaller.
|
|
|
|
*/
|
|
|
|
#define PROGRAM_CHOOSER_DEFAULT_HEIGHT 280
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *preferred_list;
|
|
|
|
GtkWidget *default_list;
|
|
|
|
} edit_dialog_details;
|
|
|
|
|
|
|
|
|
|
|
|
/* Global variables */
|
|
|
|
static edit_dialog_details *edit_application_details = NULL;
|
|
|
|
static edit_dialog_details *edit_component_details = NULL;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
|
|
|
/* Local prototypes */
|
2000-11-02 08:37:45 +00:00
|
|
|
static void show_new_application_window (GtkWidget *button, GtkWidget *list);
|
|
|
|
static void show_edit_application_window (GtkWidget *button, GtkWidget *list);
|
|
|
|
static void delete_selected_application (GtkWidget *button, GtkWidget *list);
|
2001-03-06 23:33:19 +00:00
|
|
|
static void add_item_to_application_list (GtkWidget *list, const char *id, const char *name, const char *mime_type,
|
|
|
|
gboolean user_owned, int position);
|
2000-12-08 23:36:43 +00:00
|
|
|
static void find_message_label_callback (GtkWidget *widget, gpointer callback_data);
|
|
|
|
static void find_message_label (GtkWidget *widget, const char *message);
|
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
|
|
|
static void
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
edit_applications_dialog_destroy (GtkWidget *widget, gpointer data)
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
{
|
|
|
|
g_free (edit_application_details);
|
|
|
|
edit_application_details = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
edit_component_dialog_destroy (GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
g_free (edit_component_details);
|
|
|
|
edit_component_details = NULL;
|
|
|
|
}
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
static gboolean
|
|
|
|
application_is_in_list (const char *search_id, GList *application_list)
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
{
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
GList *list_element;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
GnomeVFSMimeApplication *application;
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
if (application_list == NULL || search_id == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
/* Traverse the list looking for a match */
|
|
|
|
for (list_element = application_list; list_element != NULL; list_element = list_element->next) {
|
|
|
|
application = list_element->data;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
if (strcmp (search_id, application->id) == 0) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* application_button_toggled_callback
|
|
|
|
*
|
|
|
|
* Check state of button. Based on state, determine whether to add or remove
|
|
|
|
* application from short list.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
application_button_toggled_callback (GtkToggleButton *button, gpointer user_data)
|
|
|
|
{
|
|
|
|
const char *id;
|
|
|
|
const char *mime_type;
|
|
|
|
|
|
|
|
id = gtk_object_get_data (GTK_OBJECT (button), "application_id");
|
|
|
|
mime_type = gtk_object_get_data (GTK_OBJECT (button), "mime_type");
|
|
|
|
|
|
|
|
if (id == NULL || mime_type == NULL) {
|
|
|
|
return;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
if (gtk_toggle_button_get_active (button)) {
|
|
|
|
/* Add to preferred list */
|
|
|
|
gnome_vfs_mime_add_application_to_short_list (mime_type, id);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Remove from preferred list */
|
|
|
|
gnome_vfs_mime_remove_application_from_short_list (mime_type, id);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
static void
|
|
|
|
insert_item (GtkList *list_widget, GtkListItem *item, int position)
|
|
|
|
{
|
|
|
|
GList *singleton_list;
|
|
|
|
|
|
|
|
g_assert (GTK_IS_LIST (list_widget));
|
|
|
|
g_assert (GTK_IS_LIST_ITEM (item));
|
|
|
|
|
|
|
|
/* Due to GTK inheritance stupidity, the "Add" signal, which we
|
|
|
|
* rely on for widget sensitivity updates, is not sent if you
|
|
|
|
* use the GtkList API to add items. So when we add new items,
|
|
|
|
* which always go at the end, we must use the GtkContainer API.
|
|
|
|
*/
|
|
|
|
if (position < 0) {
|
|
|
|
gtk_container_add (GTK_CONTAINER (list_widget), GTK_WIDGET (item));
|
|
|
|
} else {
|
|
|
|
singleton_list = g_list_prepend (NULL, item);
|
|
|
|
gtk_list_insert_items (list_widget, singleton_list, position);
|
|
|
|
/* This looks like a leak of a singleton_list, but believe it or not
|
|
|
|
* gtk_list takes ownership of the list of items.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkListItem *
|
|
|
|
create_application_list_item (const char *id, const char *name, const char *mime_type,
|
|
|
|
gboolean user_owned, GList *short_list)
|
|
|
|
{
|
|
|
|
GtkWidget *list_item;
|
|
|
|
GtkWidget *hbox, *check_button, *label;
|
|
|
|
|
|
|
|
list_item = gtk_list_item_new ();
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (list_item), hbox);
|
|
|
|
|
|
|
|
check_button = gtk_check_button_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), check_button, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (name);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_widget_show_all (list_item);
|
|
|
|
|
|
|
|
/* Save ID and mime type*/
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (check_button), "application_id", g_strdup (id), g_free);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (check_button), "mime_type", g_strdup (mime_type), g_free);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "application_id", g_strdup (id), g_free);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "mime_type", g_strdup (mime_type), g_free);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (list_item), "user_owned", GINT_TO_POINTER(user_owned));
|
|
|
|
|
|
|
|
/* Check and see if component is in preferred list */
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
|
|
|
|
application_is_in_list (id, short_list));
|
|
|
|
|
|
|
|
/* Connect to toggled signal */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (application_button_toggled_callback), NULL);
|
|
|
|
|
|
|
|
return GTK_LIST_ITEM (list_item);
|
|
|
|
}
|
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
static void
|
2000-06-22 23:36:29 +00:00
|
|
|
populate_default_applications_list (GtkWidget *list, const char *mime_type)
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
{
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
GList *short_list, *app_list, *list_element;
|
|
|
|
GnomeVFSMimeApplication *application;
|
2001-03-06 23:33:19 +00:00
|
|
|
GtkListItem *list_item;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
|
|
|
/* Get the application short list */
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
|
|
|
|
|
|
|
|
/* Get the list of all applications */
|
|
|
|
app_list = gnome_vfs_mime_get_all_applications (mime_type);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
if (app_list != NULL) {
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
for (list_element = app_list; list_element != NULL; list_element = list_element->next) {
|
|
|
|
application = list_element->data;
|
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
/* Create list item */
|
2001-03-06 23:33:19 +00:00
|
|
|
list_item = create_application_list_item (application->id, application->name,
|
|
|
|
mime_type,
|
|
|
|
gnome_vfs_application_is_user_owned_application (application),
|
|
|
|
short_list);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
insert_item (GTK_LIST (list), list_item, -1);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
}
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
gnome_vfs_mime_application_list_free (app_list);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
gnome_vfs_mime_application_list_free (short_list);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
component_is_in_list (const char *search_name, GList *component_list)
|
|
|
|
{
|
|
|
|
GList *list_element;
|
2001-12-02 21:31:22 +00:00
|
|
|
Bonobo_ServerInfo *info;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
gchar *component_name;
|
|
|
|
|
|
|
|
if (component_list == NULL || search_name == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Traverse the list looking for a match */
|
|
|
|
for (list_element = component_list; list_element != NULL; list_element = list_element->next) {
|
|
|
|
info = list_element->data;
|
|
|
|
|
|
|
|
component_name = name_from_oaf_server_info (info);
|
|
|
|
|
|
|
|
if (strcmp (search_name, component_name) == 0) {
|
|
|
|
g_free (component_name);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
g_free (component_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* component_button_toggled_callback
|
|
|
|
*
|
|
|
|
* Check state of button. Based on state, determine whether to add or remove
|
|
|
|
* component from short list.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
component_button_toggled_callback (GtkToggleButton *button, gpointer user_data)
|
|
|
|
{
|
|
|
|
const char *iid;
|
|
|
|
const char *mime_type;
|
|
|
|
|
|
|
|
iid = gtk_object_get_data (GTK_OBJECT (button), "component_iid");
|
|
|
|
mime_type = gtk_object_get_data (GTK_OBJECT (button), "mime_type");
|
|
|
|
|
|
|
|
if (iid == NULL || mime_type == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (button)) {
|
|
|
|
/* Add to preferred list */
|
|
|
|
gnome_vfs_mime_add_component_to_short_list (mime_type, iid);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Remove from preferred list */
|
|
|
|
gnome_vfs_mime_remove_component_from_short_list (mime_type, iid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
populate_default_components_box (GtkWidget *box, const char *mime_type)
|
|
|
|
{
|
|
|
|
GList *short_component_list;
|
|
|
|
GList *all_component_list, *list_element;
|
2001-12-02 21:31:22 +00:00
|
|
|
Bonobo_ServerInfo *info;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
gchar *component_name;
|
|
|
|
GtkWidget *button;
|
2000-06-22 23:36:29 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
/* Get short list of components */
|
|
|
|
short_component_list = gnome_vfs_mime_get_short_list_components (mime_type);
|
|
|
|
|
|
|
|
/* Get list of all components */
|
|
|
|
all_component_list = gnome_vfs_mime_get_all_components (mime_type);
|
|
|
|
if (all_component_list != NULL) {
|
|
|
|
for (list_element = all_component_list; list_element != NULL; list_element = list_element->next) {
|
|
|
|
info = list_element->data;
|
|
|
|
|
|
|
|
component_name = name_from_oaf_server_info (info);
|
|
|
|
button = gtk_check_button_new_with_label (component_name);
|
|
|
|
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
|
2000-06-22 23:36:29 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
/* Save IID and mime type*/
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (button), "component_iid", g_strdup (info->iid), g_free);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (button), "mime_type", g_strdup (mime_type), g_free);
|
|
|
|
|
|
|
|
/* Check and see if component is in preferred list */
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
|
|
|
component_is_in_list (component_name, short_component_list));
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
/* Connect to toggled signal */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (component_button_toggled_callback), NULL);
|
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
g_free (component_name);
|
|
|
|
}
|
|
|
|
gnome_vfs_mime_component_list_free (all_component_list);
|
|
|
|
|
|
|
|
if (short_component_list != NULL) {
|
|
|
|
gnome_vfs_mime_component_list_free (short_component_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-02 22:34:42 +00:00
|
|
|
typedef struct {
|
|
|
|
GtkWidget *add_button;
|
|
|
|
GtkWidget *edit_button;
|
|
|
|
GtkWidget *delete_button;
|
|
|
|
} ButtonHolder;
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_button_status (GtkList *list, GtkWidget *widget, ButtonHolder *button_holder)
|
|
|
|
{
|
|
|
|
int length = g_list_length (list->children);
|
|
|
|
|
|
|
|
if (length == 0) {
|
|
|
|
gtk_widget_set_sensitive (button_holder->delete_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (button_holder->edit_button, FALSE);
|
|
|
|
} else {
|
|
|
|
gtk_widget_set_sensitive (button_holder->edit_button, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
static void
|
|
|
|
update_delete_button (GtkList *list, GtkWidget *widget, ButtonHolder *button_holder)
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (button_holder->delete_button,
|
|
|
|
GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), "user_owned")));
|
|
|
|
}
|
|
|
|
|
2000-11-02 22:34:42 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
/*
|
|
|
|
* initialize_edit_applications_dialog
|
|
|
|
*
|
|
|
|
* Set up dialog for default application list editing
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
initialize_edit_applications_dialog (const char *mime_type)
|
|
|
|
{
|
2000-06-22 23:36:29 +00:00
|
|
|
GtkWidget *main_vbox, *hbox;
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
GtkWidget *scroller, *label;
|
2000-06-22 23:36:29 +00:00
|
|
|
GtkWidget *button, *list;
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
char *label_text;
|
2000-11-02 22:34:42 +00:00
|
|
|
ButtonHolder *button_holder;
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
|
|
|
edit_application_details = g_new0 (edit_dialog_details, 1);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
edit_application_details->window = gnome_dialog_new (_("Edit Applications List"),
|
|
|
|
GNOME_STOCK_BUTTON_OK,
|
2000-11-02 22:34:42 +00:00
|
|
|
NULL,
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
NULL);
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* FIXME: dialog should be parented on Control Center window */
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (edit_application_details->window), GNOME_PAD);
|
|
|
|
gtk_window_set_policy (GTK_WINDOW (edit_application_details->window), FALSE, TRUE, FALSE);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (edit_application_details->window),
|
|
|
|
NO_DEFAULT_MAGIC_NUMBER,
|
|
|
|
PROGRAM_CHOOSER_DEFAULT_HEIGHT);
|
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (edit_application_details->window),
|
|
|
|
"destroy",
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
edit_applications_dialog_destroy,
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Main vertical box */
|
|
|
|
main_vbox = GNOME_DIALOG (edit_application_details->window)->vbox;
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
/* Add label */
|
2001-03-06 23:33:19 +00:00
|
|
|
label_text = g_strdup_printf (_("Select applications to appear in menu for MIME type \"%s\""), mime_type);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
label = gtk_label_new (label_text);
|
|
|
|
g_free (label_text);
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
/* Add scrolling list of check buttons */
|
|
|
|
scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (main_vbox), scroller);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
list = gtk_list_new ();
|
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller), list);
|
|
|
|
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
2000-11-02 22:34:42 +00:00
|
|
|
/* Add edit buttons */
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
2000-06-21 18:39:48 +00:00
|
|
|
|
2000-11-02 22:34:42 +00:00
|
|
|
button_holder = g_new (ButtonHolder, 1);
|
|
|
|
|
2000-06-21 18:39:48 +00:00
|
|
|
button = gtk_button_new_with_label (_("Add Application..."));
|
2000-11-02 08:37:45 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (button), "mime_type", g_strdup (mime_type), g_free);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", show_new_application_window, list);
|
2000-11-02 22:34:42 +00:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
|
|
|
|
button_holder->add_button = button;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
2000-06-21 18:39:48 +00:00
|
|
|
button = gtk_button_new_with_label (_("Edit Application..."));
|
2000-11-02 08:37:45 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", show_edit_application_window, list);
|
2000-11-02 22:34:42 +00:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
|
|
|
|
button_holder->edit_button = button;
|
2000-06-21 18:39:48 +00:00
|
|
|
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
button = gtk_button_new_with_label (_("Delete Application"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
2000-11-02 08:37:45 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", delete_selected_application, list);
|
2000-11-02 22:34:42 +00:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
|
|
|
|
button_holder->delete_button = button;
|
|
|
|
|
|
|
|
/* Watch container so we can update buttons */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (list), "add", check_button_status, button_holder);
|
|
|
|
gtk_signal_connect_full (GTK_OBJECT (list), "remove", check_button_status, NULL, button_holder,
|
2001-03-06 23:33:19 +00:00
|
|
|
g_free, FALSE, FALSE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (list), "select_child", update_delete_button, button_holder);
|
2000-11-02 22:34:42 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
gtk_widget_show_all (main_vbox);
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
populate_default_applications_list (list, mime_type);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
/*
|
|
|
|
* initialize_edit_components_dialog
|
|
|
|
*
|
|
|
|
* Set up dialog for default component list editing
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
initialize_edit_components_dialog (const char *mime_type)
|
|
|
|
{
|
|
|
|
GtkWidget *main_vbox, *vbox;
|
|
|
|
GtkWidget *scroller, *label;
|
|
|
|
char *label_text;
|
|
|
|
|
|
|
|
edit_component_details = g_new0 (edit_dialog_details, 1);
|
|
|
|
|
|
|
|
edit_component_details->window = gnome_dialog_new (_("Edit Components List"),
|
|
|
|
GNOME_STOCK_BUTTON_OK,
|
2000-11-02 22:34:42 +00:00
|
|
|
NULL,
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (edit_component_details->window), GNOME_PAD);
|
|
|
|
gtk_window_set_policy (GTK_WINDOW (edit_component_details->window), FALSE, TRUE, FALSE);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (edit_component_details->window),
|
|
|
|
NO_DEFAULT_MAGIC_NUMBER,
|
|
|
|
PROGRAM_CHOOSER_DEFAULT_HEIGHT);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (edit_component_details->window),
|
|
|
|
"destroy",
|
|
|
|
edit_component_dialog_destroy,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Main vertical box */
|
|
|
|
main_vbox = GNOME_DIALOG (edit_component_details->window)->vbox;
|
|
|
|
|
|
|
|
/* Add label */
|
2001-03-06 23:33:19 +00:00
|
|
|
label_text = g_strdup_printf (_("Select views to appear in menu for MIME type \"%s\""), mime_type);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
label = gtk_label_new (label_text);
|
|
|
|
g_free (label_text);
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* Add scrolling list of check buttons */
|
|
|
|
scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (main_vbox), scroller);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller), vbox);
|
|
|
|
|
|
|
|
populate_default_components_box (vbox, mime_type);
|
|
|
|
|
|
|
|
gtk_widget_show_all (main_vbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* show_edit_applications_dialog
|
|
|
|
*
|
|
|
|
* Setup and display edit application list dialog
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
show_edit_applications_dialog (const char *mime_type)
|
|
|
|
{
|
|
|
|
if (edit_application_details == NULL) {
|
|
|
|
initialize_edit_applications_dialog (mime_type);
|
|
|
|
}
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
/* FIXME: This is a modal dialog with no Cancel button, so the close box
|
|
|
|
* has to do the same thing as the OK button, which is pretty darn confusing.
|
|
|
|
* It would be better to make it modeless someday.
|
|
|
|
*/
|
|
|
|
gnome_dialog_run_and_close (GNOME_DIALOG (edit_application_details->window));
|
|
|
|
nautilus_mime_type_capplet_update_application_info (mime_type);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* show_edit_components_dialog
|
|
|
|
*
|
|
|
|
* Setup and display edit component list dialog
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
show_edit_components_dialog (const char *mime_type)
|
|
|
|
{
|
|
|
|
if (edit_component_details == NULL) {
|
|
|
|
initialize_edit_components_dialog (mime_type);
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* FIXME: This is a modal dialog with no Cancel button, so the close box
|
|
|
|
* has to do the same thing as the OK button, which is pretty darn confusing.
|
|
|
|
* It would be better to make it modeless someday.
|
|
|
|
*/
|
|
|
|
gnome_dialog_run_and_close (GNOME_DIALOG (edit_component_details->window));
|
|
|
|
|
|
|
|
nautilus_mime_type_capplet_update_viewer_info (mime_type);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GSList *
|
|
|
|
get_lang_list (void)
|
|
|
|
{
|
|
|
|
GSList *retval;
|
|
|
|
char *lang;
|
|
|
|
char * equal_char;
|
|
|
|
|
|
|
|
retval = NULL;
|
|
|
|
|
|
|
|
lang = g_getenv ("LANGUAGE");
|
|
|
|
|
|
|
|
if (!lang) {
|
|
|
|
lang = g_getenv ("LANG");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lang) {
|
|
|
|
equal_char = strchr (lang, '=');
|
|
|
|
if (equal_char != NULL) {
|
|
|
|
lang = equal_char + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = g_slist_prepend (retval, lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
str_has_prefix (const char *haystack, const char *needle)
|
|
|
|
{
|
|
|
|
const char *h, *n;
|
|
|
|
|
|
|
|
/* Eat one character at a time. */
|
|
|
|
h = haystack == NULL ? "" : haystack;
|
|
|
|
n = needle == NULL ? "" : needle;
|
|
|
|
do {
|
|
|
|
if (*n == '\0') {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (*h == '\0') {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} while (*h++ == *n++);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2001-12-02 21:31:22 +00:00
|
|
|
name_from_oaf_server_info (Bonobo_ServerInfo *server)
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
{
|
|
|
|
const char *view_as_name;
|
|
|
|
char *display_name;
|
|
|
|
GSList *langs;
|
|
|
|
|
|
|
|
display_name = NULL;
|
|
|
|
|
|
|
|
langs = get_lang_list ();
|
2001-12-02 21:31:22 +00:00
|
|
|
view_as_name = bonobo_server_info_prop_lookup (server, "nautilus:view_as_name", langs);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
|
|
|
|
if (view_as_name == NULL) {
|
2001-12-02 21:31:22 +00:00
|
|
|
view_as_name = bonobo_server_info_prop_lookup (server, "name", langs);
|
New files. Trying to clean up current capplet source and organize it in a
2000-06-14 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
New files. Trying to clean up current capplet source and
organize it in a sensible way.
(edit_application_dialog_destroy), (edit_component_dialog_destroy),
(populate_default_applications_list),
(populate_preferred_applications_list), (component_is_in_list),
(component_button_toggled_callback),
(populate_default_components_box),
(populate_preferred_components_list),
(initialize_edit_applications_dialog),
(initialize_edit_components_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
Brand new functions.
* mime-type-capplet/Makefile.am:
Added new source file listed above.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (populate_application_menu),
(populate_component_menu), (edit_applications_clicked),
(edit_components_clicked):
Work on setting up info view.
2000-06-15 06:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (view_as_name == NULL) {
|
|
|
|
view_as_name = server->iid;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (langs);
|
|
|
|
|
|
|
|
/* if the name is an OAFIID, clean it up for display */
|
|
|
|
if (str_has_prefix (view_as_name, "OAFIID:")) {
|
|
|
|
char *display_name, *colon_ptr;
|
|
|
|
display_name = g_strdup (view_as_name + 7);
|
|
|
|
colon_ptr = strchr (display_name, ':');
|
|
|
|
if (colon_ptr) {
|
|
|
|
*colon_ptr = '\0';
|
|
|
|
}
|
|
|
|
return display_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return g_strdup(view_as_name);
|
|
|
|
}
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2000-12-08 23:36:43 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
find_message_label_callback (GtkWidget *widget, gpointer callback_data)
|
|
|
|
{
|
|
|
|
find_message_label (widget, callback_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
find_message_label (GtkWidget *widget, const char *message)
|
|
|
|
{
|
|
|
|
char *text;
|
|
|
|
|
|
|
|
/* Turn on the flag if we find a label with the message
|
|
|
|
* in it.
|
|
|
|
*/
|
|
|
|
if (GTK_IS_LABEL (widget)) {
|
|
|
|
gtk_label_get (GTK_LABEL (widget), &text);
|
|
|
|
if (strcmp (text, message) == 0) {
|
|
|
|
gtk_object_set_data (GTK_OBJECT (gtk_widget_get_toplevel (widget)),
|
|
|
|
"message label", widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Recurse for children. */
|
|
|
|
if (GTK_IS_CONTAINER (widget)) {
|
|
|
|
gtk_container_foreach (GTK_CONTAINER (widget),
|
|
|
|
find_message_label_callback,
|
|
|
|
(char *) message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GnomeDialog *
|
|
|
|
show_message_box (const char *message,
|
|
|
|
const char *dialog_title,
|
|
|
|
const char *type,
|
|
|
|
const char *button_one,
|
|
|
|
const char *button_two,
|
|
|
|
GtkWindow *parent)
|
|
|
|
{
|
|
|
|
GtkWidget *box;
|
|
|
|
GtkLabel *message_label;
|
|
|
|
|
|
|
|
g_assert (dialog_title != NULL);
|
|
|
|
|
|
|
|
box = gnome_message_box_new (message, type, button_one, button_two, NULL);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (box), dialog_title);
|
|
|
|
|
|
|
|
/* A bit of a hack. We want to use gnome_message_box_new,
|
|
|
|
* but we want the message to be wrapped. So, we search
|
|
|
|
* for the label with this message so we can mark it.
|
|
|
|
*/
|
|
|
|
find_message_label (box, message);
|
|
|
|
message_label = GTK_LABEL (gtk_object_get_data (GTK_OBJECT (box), "message label"));
|
|
|
|
gtk_label_set_line_wrap (message_label, TRUE);
|
|
|
|
|
|
|
|
if (parent != NULL) {
|
|
|
|
gnome_dialog_set_parent (GNOME_DIALOG (box), parent);
|
|
|
|
}
|
|
|
|
gtk_widget_show (box);
|
|
|
|
return GNOME_DIALOG (box);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
display_upper_case_dialog (void)
|
|
|
|
{
|
|
|
|
char *message;
|
2000-12-21 21:51:58 +00:00
|
|
|
GnomeDialog *dialog;
|
2000-12-08 23:36:43 +00:00
|
|
|
|
|
|
|
message = _("The MIME type entered contained upper case characters. "
|
|
|
|
"Upper case characters were changed to lower case for you.");
|
|
|
|
|
|
|
|
dialog = show_message_box (message, _("Add New MIME Type"),
|
|
|
|
GNOME_MESSAGE_BOX_INFO, GNOME_STOCK_BUTTON_OK,
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
gnome_dialog_run_and_close (dialog);
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* Do some basic validation of the text entry and enable the OK button if the text is
|
|
|
|
* determined to be a valid string.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
validate_text_and_update_button (GtkEntry *entry, gpointer data)
|
|
|
|
{
|
|
|
|
char *text, *token;
|
|
|
|
gboolean sensitize;
|
|
|
|
|
|
|
|
sensitize = TRUE;
|
|
|
|
|
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text == NULL) {
|
|
|
|
sensitize = FALSE;
|
|
|
|
} else {
|
|
|
|
token = strtok (text, " ");
|
|
|
|
if (token == NULL || strlen (token) <= 0) {
|
|
|
|
/* Entered text is invalid as best as we can detect. */
|
|
|
|
sensitize = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (data), sensitize);
|
|
|
|
}
|
2000-12-08 23:36:43 +00:00
|
|
|
|
2000-09-17 03:15:40 +00:00
|
|
|
char *
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
nautilus_mime_type_capplet_show_new_mime_window (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *mime_entry;
|
|
|
|
GtkWidget *label;
|
2000-09-17 03:15:40 +00:00
|
|
|
GtkWidget *desc_entry;
|
2000-11-20 19:43:30 +00:00
|
|
|
const char *description;
|
2000-12-08 23:36:43 +00:00
|
|
|
char *mime_type, *tmp_str, c;
|
|
|
|
gboolean upper_case_alert;
|
|
|
|
|
2000-09-17 03:15:40 +00:00
|
|
|
mime_type = NULL;
|
2000-12-08 23:36:43 +00:00
|
|
|
upper_case_alert = FALSE;
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
dialog = gnome_dialog_new (_("Add MIME Type"), GNOME_STOCK_BUTTON_OK,
|
2000-11-20 19:43:30 +00:00
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
2000-11-17 00:41:44 +00:00
|
|
|
gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
label = gtk_label_new (_("New MIME type (e.g. image/x-thumper):"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
|
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
mime_entry = gtk_entry_new ();
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), mime_entry, TRUE, TRUE, 0);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
label = gtk_label_new (_("Description (e.g. Thumper image):"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
|
|
|
|
|
2000-09-17 03:15:40 +00:00
|
|
|
desc_entry = gtk_entry_new ();
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), desc_entry, TRUE, TRUE, 0);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* Set up text entry validation signal */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (mime_entry), "changed",
|
|
|
|
GTK_SIGNAL_FUNC (validate_text_and_update_button), GNOME_DIALOG (dialog)->buttons->data);
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* Set initial OK button state to desensitized */
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (GNOME_DIALOG (dialog)->buttons->data), FALSE);
|
|
|
|
|
|
|
|
/* Set focus to text entry widget */
|
|
|
|
gtk_widget_grab_focus (mime_entry);
|
2000-11-17 00:41:44 +00:00
|
|
|
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox);
|
2000-11-20 19:43:30 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_OK) {
|
|
|
|
mime_type = g_strdup (gtk_entry_get_text (GTK_ENTRY (mime_entry)));
|
|
|
|
g_assert (mime_type != NULL);
|
|
|
|
|
|
|
|
/* Handle illegal mime types as best we can */
|
|
|
|
for (tmp_str = mime_type; (c = *tmp_str) != '\0'; tmp_str++) {
|
|
|
|
if (isascii ((guchar) c) && isupper ((guchar) c)) {
|
|
|
|
*tmp_str = tolower (c);
|
|
|
|
upper_case_alert = TRUE;
|
2000-09-17 03:15:40 +00:00
|
|
|
}
|
2001-03-06 23:33:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
description = gtk_entry_get_text (GTK_ENTRY (desc_entry));
|
|
|
|
|
|
|
|
/* Add new mime type here */
|
|
|
|
if (strlen (mime_type) > 3) {
|
|
|
|
/* This call creates the key */
|
|
|
|
gnome_vfs_mime_set_registered_type_key (mime_type,
|
|
|
|
"description",
|
|
|
|
description);
|
|
|
|
|
|
|
|
/* Ths call sets the user information */
|
|
|
|
gnome_vfs_mime_set_value (mime_type,
|
|
|
|
"description",
|
|
|
|
description);
|
|
|
|
}
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
}
|
2000-11-17 00:41:44 +00:00
|
|
|
|
|
|
|
gnome_dialog_close (GNOME_DIALOG (dialog));
|
|
|
|
|
2000-12-08 23:36:43 +00:00
|
|
|
if (upper_case_alert) {
|
|
|
|
display_upper_case_dialog ();
|
|
|
|
}
|
|
|
|
|
2000-09-17 03:15:40 +00:00
|
|
|
return mime_type;
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
}
|
|
|
|
|
2000-11-20 02:31:25 +00:00
|
|
|
static void
|
|
|
|
add_extension_clicked (GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
GtkList *extension_list;
|
|
|
|
char *new_extension;
|
|
|
|
GtkWidget *new_list_item;
|
|
|
|
GList *items_list;
|
|
|
|
|
|
|
|
g_assert (GTK_IS_LIST (data));
|
|
|
|
|
|
|
|
extension_list = GTK_LIST (data);
|
|
|
|
|
|
|
|
new_extension = nautilus_mime_type_capplet_show_new_extension_window ();
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
/* Filter out bogus extensions */
|
|
|
|
if (new_extension == NULL || strlen (new_extension) <= 0 || new_extension[0] == ' ') {
|
|
|
|
g_free (new_extension);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-11-20 02:31:25 +00:00
|
|
|
new_list_item = gtk_list_item_new_with_label (new_extension);
|
|
|
|
gtk_widget_show (new_list_item);
|
|
|
|
|
|
|
|
items_list = g_list_append (NULL, new_list_item);
|
|
|
|
gtk_list_append_items (GTK_LIST (extension_list), items_list);
|
|
|
|
g_free (new_extension);
|
|
|
|
/* GtkList takes ownership of the List we append. DO NOT free it. */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
remove_extension_clicked (GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
GtkList *list;
|
|
|
|
GList *selection_copy, *temp;
|
|
|
|
|
|
|
|
g_assert (GTK_IS_LIST (data));
|
|
|
|
|
|
|
|
list = GTK_LIST (data);
|
|
|
|
|
|
|
|
/* this is so fucking crapy !!! */
|
|
|
|
/* you have to make a copy of the selection list before
|
|
|
|
passing it to remove_items because before removing the
|
|
|
|
widget from the List, it modifies the list.
|
|
|
|
So, when you remove it, the list is not valid anymore */
|
|
|
|
selection_copy = NULL;
|
|
|
|
for (temp = list->selection; temp != NULL; temp = temp->next) {
|
|
|
|
selection_copy = g_list_prepend (selection_copy, temp->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list->selection != NULL) {
|
|
|
|
gtk_list_remove_items (GTK_LIST (list), selection_copy);
|
|
|
|
gtk_list_select_item (GTK_LIST (list), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (selection_copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
extension_list_selected (GtkWidget *list, GtkWidget *child, gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
g_assert (GTK_IS_BUTTON (data));
|
|
|
|
|
|
|
|
button = GTK_WIDGET (data);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
extension_list_deselected (GtkWidget *list, GtkWidget *child, gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
g_assert (GTK_IS_BUTTON (data));
|
|
|
|
|
|
|
|
button = GTK_WIDGET (data);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
get_extensions_from_gtk_list (GtkList *list)
|
|
|
|
{
|
|
|
|
GList *temp;
|
|
|
|
GtkLabel *label;
|
|
|
|
char *extension, *extensions, *temp_text;
|
|
|
|
|
|
|
|
extensions = NULL;
|
|
|
|
for (temp = list->children; temp != NULL; temp = temp->next) {
|
|
|
|
label = GTK_LABEL (GTK_BIN (temp->data)->child);
|
|
|
|
gtk_label_get (GTK_LABEL (label), &extension);
|
|
|
|
temp_text = g_strconcat (extension, " ", extensions, NULL);
|
|
|
|
g_free (extensions);
|
|
|
|
extensions = temp_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
return extensions;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2001-03-06 23:33:19 +00:00
|
|
|
nautilus_mime_type_capplet_show_change_extension_window (const char *mime_type, gboolean *new_list)
|
2000-11-20 02:31:25 +00:00
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *list;
|
2001-03-06 23:33:19 +00:00
|
|
|
char *extensions_list_str;
|
2000-11-20 02:31:25 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
*new_list = FALSE;
|
|
|
|
|
2000-11-20 02:31:25 +00:00
|
|
|
dialog = gnome_dialog_new (_("File Extensions "),
|
|
|
|
GNOME_STOCK_BUTTON_OK,
|
|
|
|
GNOME_STOCK_BUTTON_CANCEL,
|
|
|
|
NULL);
|
|
|
|
gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
|
|
|
|
gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_BIG);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
|
|
|
|
list = gtk_list_new ();
|
|
|
|
|
|
|
|
/* the right buttons */
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label (_("Add..."));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
|
|
|
add_extension_clicked, list);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label (_(" Remove "));
|
|
|
|
gtk_widget_set_sensitive (button, FALSE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
|
|
|
remove_extension_clicked, list);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (""), FALSE, FALSE, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The left list */
|
|
|
|
{
|
|
|
|
GtkWidget *viewport;
|
|
|
|
GList *extensions_list, *widget_list, *temp;
|
|
|
|
|
|
|
|
viewport = gtk_viewport_new (NULL, NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), viewport, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (list), "select_child",
|
|
|
|
extension_list_selected, button);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (list), "unselect_child",
|
|
|
|
extension_list_deselected, button);
|
|
|
|
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (viewport), list);
|
|
|
|
|
|
|
|
|
|
|
|
extensions_list = gnome_vfs_mime_get_extensions_list (mime_type);
|
|
|
|
if (extensions_list != NULL) {
|
|
|
|
widget_list = NULL;
|
|
|
|
for (temp = extensions_list; temp != NULL; temp = temp->next) {
|
|
|
|
widget_list = g_list_append (widget_list,
|
|
|
|
gtk_list_item_new_with_label ((char *) temp->data));
|
|
|
|
}
|
|
|
|
gtk_list_append_items (GTK_LIST (list), widget_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_list_select_item (GTK_LIST (list), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox);
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
extensions_list_str = NULL;
|
|
|
|
if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_OK) {
|
|
|
|
*new_list = TRUE;
|
|
|
|
extensions_list_str = get_extensions_from_gtk_list (GTK_LIST (list));
|
|
|
|
if (extensions_list_str == NULL) {
|
|
|
|
extensions_list_str = g_strdup ("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (extensions_list_str == NULL) {
|
|
|
|
extensions_list_str = g_strdup ("");
|
|
|
|
}
|
2000-11-20 02:31:25 +00:00
|
|
|
gnome_dialog_close (GNOME_DIALOG (dialog));
|
|
|
|
|
2000-11-20 19:43:30 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
return extensions_list_str;
|
2000-11-20 02:31:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
nautilus_mime_type_capplet_show_new_extension_window (void)
|
|
|
|
{
|
|
|
|
GtkWidget *mime_entry;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *dialog;
|
2000-11-20 02:31:25 +00:00
|
|
|
char *new_extension;
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
|
2000-11-20 02:31:25 +00:00
|
|
|
dialog = gnome_dialog_new (_("Add New Extension"), GNOME_STOCK_BUTTON_OK,
|
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
|
|
|
gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
|
|
|
|
gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE);
|
2001-03-06 23:33:19 +00:00
|
|
|
label = gtk_label_new (_("Type in the extensions for this mime-type (without dot).\n"
|
|
|
|
"You can enter several extensions seperated by a space,\n"
|
|
|
|
"for example: html htm"));
|
Work in progress on the FIle Types and Programs Capplet Removed obsolete
2000-06-15 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the FIle Types and Programs Capplet
* mime-type-capplet/Makefile.am:
Removed obsolete files form build.
* mime-type-capplet/edit-window.c:
* mime-type-capplet/edit-window.h:
Obsolete. Removed.
* mime-type-capplet/new-mime-window.c:
* mime-type-capplet/new-mime-window.h:
Obsolete. Removed.
* mime-type-capplet/mime-data.c: (add_mime_vals_to_clist),
(selected_row_callback):
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.h:
(edit_applications_dialog_destroy), (application_is_in_list),
(application_button_toggled_callback),
(populate_default_applications_box),
(populate_default_components_box),
(initialize_edit_applications_dialog),
(show_edit_applications_dialog), (show_edit_components_dialog),
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(revert_callback), (populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(add_extension_clicked), (remove_extension),
(extension_list_selected), (extension_list_deselected),
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(add_mime_clicked), (edit_components_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_component_info):
2000-06-15 23:32:08 +00:00
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
label = gtk_label_new (_("Extension:"));
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
mime_entry = gtk_entry_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), mime_entry, TRUE, TRUE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox);
|
2000-06-20 18:55:19 +00:00
|
|
|
|
|
|
|
/* Set focus to text entry widget */
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_widget_grab_focus (mime_entry);
|
2000-11-20 02:31:25 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_OK) {
|
|
|
|
new_extension = g_strdup (gtk_entry_get_text (GTK_ENTRY (mime_entry)));
|
|
|
|
} else {
|
|
|
|
new_extension = g_strdup ("");
|
|
|
|
}
|
2000-11-20 02:31:25 +00:00
|
|
|
|
|
|
|
gnome_dialog_close (GNOME_DIALOG (dialog));
|
|
|
|
|
|
|
|
return new_extension;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
}
|
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
/* add_or_update_application
|
2000-06-22 23:36:29 +00:00
|
|
|
*
|
2000-11-02 08:37:45 +00:00
|
|
|
* Create or update a GnomeVFSMimeApplication and register
|
2000-06-22 23:36:29 +00:00
|
|
|
* it with the mime database.
|
|
|
|
*/
|
2001-03-06 23:33:19 +00:00
|
|
|
static char *
|
2000-11-02 08:37:45 +00:00
|
|
|
add_or_update_application (GtkWidget *list, const char *name, const char *command,
|
Add support for the "supported_uri_schemes" attributes in the mime
2001-01-26 Rebecca Schulman <rebecka@eazel.com>
Add support for the "supported_uri_schemes"
attributes in the mime applications file,
and changed can_open_uris to "expects_uris"
because this attribute is more about
the way arguments should be specified than
about its capabilities of understanding
locations.
The supported uri schemes attributes is
optional, and if it is not included, the
value is assumed to be file.
reviewed by: Pavel Cisler <pavel@eazel.com>
* libgnomevfs/gnome-vfs-application-registry.h:
Add the new function
gnome_vfs_application_registry_supports_uri_scheme to the
public api
* libgnomevfs/gnome-vfs-application-registry.c: (application_new),
(add_application_to_mime_type_table),
(add_mime_type_to_application),
(add_supported_uri_scheme_to_application),
(remove_application_from_mime_type_table),
(remove_mime_type_for_application),
(supported_uri_scheme_list_copy),
(gnome_vfs_application_registry_supports_uri_scheme),
(gnome_vfs_application_registry_supports_mime_type),
(gnome_vfs_application_registry_add_mime_type),
(gnome_vfs_application_registry_remove_mime_type),
Add supported uri schemes functions to complement
the current mime type functions
and refactor the mime_type functions to share code with
the new supported_uri_schemes functions where
appropriate
(application_clear_mime_types),
(application_add_key),
Add ability to parse the supported_uri_schemes attribute
(gnome_vfs_application_registry_get_mime_application),
(gnome_vfs_application_registry_save_mime_application):
Add supported_uri_schemes to these functions
* libgnomevfs/gnome-vfs-mime-handlers.h:
* libgnomevfs/gnome-vfs-mime-handlers.c:
(gnome_vfs_mime_get_short_list_applications),
(gnome_vfs_mime_application_copy),
(gnome_vfs_mime_application_free),
(copy_str_list):
Add supported_uri_schemes to the MimeApplication
structure
* data/mime/gnome-vfs.applications:
Add some new "supported_uri_schemes".
What I have added is not complete.
* doc/mime-data-specification.txt:
Add information about how user files can augment, but
not replace information about applications' accepted mime
types and supported uri schemes. Add FIXMEs about
how this isn't clearly correct.
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(add_or_update_application), (show_new_application_window),
(show_edit_application_window):
Change can_open_uris to "Expects URIs"
* test/test-mime-handlers-set.c: (main):
* test/test-mime-handlers.c: (append_comma_and_scheme),
(format_supported_uri_schemes_for_display), (print_application):
Update tests, by adding new attribute
2001-01-26 23:13:49 +00:00
|
|
|
gboolean multiple, gboolean expects_uris,
|
|
|
|
gboolean update)
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
{
|
2000-11-02 08:37:45 +00:00
|
|
|
GnomeVFSMimeApplication app, *original;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
const char *mime_type;
|
2001-03-06 23:33:19 +00:00
|
|
|
uuid_t app_uuid;
|
|
|
|
char app_uuid_string[100];
|
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
/* Check for empty strings. Command can be empty. */
|
2000-08-09 06:23:46 +00:00
|
|
|
if (name[0] == '\0') {
|
2001-03-06 23:33:19 +00:00
|
|
|
return NULL;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mime_type = nautilus_mime_type_capplet_get_selected_item_mime_type ();
|
2000-08-09 06:23:46 +00:00
|
|
|
g_assert (mime_type != NULL);
|
|
|
|
|
|
|
|
/* It's ok to cast, we don't modify the application
|
|
|
|
* structure and thus the name/command, this should really
|
|
|
|
* use the application registry explicitly */
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
/* Generate unique application id */
|
|
|
|
uuid_generate(app_uuid);
|
|
|
|
uuid_unparse(app_uuid, app_uuid_string);
|
|
|
|
app.id = app_uuid_string;
|
2000-08-09 06:23:46 +00:00
|
|
|
app.name = (char *)name;
|
|
|
|
app.command = (char *)command;
|
|
|
|
app.can_open_multiple_files = multiple;
|
Add support for the "supported_uri_schemes" attributes in the mime
2001-01-26 Rebecca Schulman <rebecka@eazel.com>
Add support for the "supported_uri_schemes"
attributes in the mime applications file,
and changed can_open_uris to "expects_uris"
because this attribute is more about
the way arguments should be specified than
about its capabilities of understanding
locations.
The supported uri schemes attributes is
optional, and if it is not included, the
value is assumed to be file.
reviewed by: Pavel Cisler <pavel@eazel.com>
* libgnomevfs/gnome-vfs-application-registry.h:
Add the new function
gnome_vfs_application_registry_supports_uri_scheme to the
public api
* libgnomevfs/gnome-vfs-application-registry.c: (application_new),
(add_application_to_mime_type_table),
(add_mime_type_to_application),
(add_supported_uri_scheme_to_application),
(remove_application_from_mime_type_table),
(remove_mime_type_for_application),
(supported_uri_scheme_list_copy),
(gnome_vfs_application_registry_supports_uri_scheme),
(gnome_vfs_application_registry_supports_mime_type),
(gnome_vfs_application_registry_add_mime_type),
(gnome_vfs_application_registry_remove_mime_type),
Add supported uri schemes functions to complement
the current mime type functions
and refactor the mime_type functions to share code with
the new supported_uri_schemes functions where
appropriate
(application_clear_mime_types),
(application_add_key),
Add ability to parse the supported_uri_schemes attribute
(gnome_vfs_application_registry_get_mime_application),
(gnome_vfs_application_registry_save_mime_application):
Add supported_uri_schemes to these functions
* libgnomevfs/gnome-vfs-mime-handlers.h:
* libgnomevfs/gnome-vfs-mime-handlers.c:
(gnome_vfs_mime_get_short_list_applications),
(gnome_vfs_mime_application_copy),
(gnome_vfs_mime_application_free),
(copy_str_list):
Add supported_uri_schemes to the MimeApplication
structure
* data/mime/gnome-vfs.applications:
Add some new "supported_uri_schemes".
What I have added is not complete.
* doc/mime-data-specification.txt:
Add information about how user files can augment, but
not replace information about applications' accepted mime
types and supported uri schemes. Add FIXMEs about
how this isn't clearly correct.
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(add_or_update_application), (show_new_application_window),
(show_edit_application_window):
Change can_open_uris to "Expects URIs"
* test/test-mime-handlers-set.c: (main):
* test/test-mime-handlers.c: (append_comma_and_scheme),
(format_supported_uri_schemes_for_display), (print_application):
Update tests, by adding new attribute
2001-01-26 23:13:49 +00:00
|
|
|
app.expects_uris = expects_uris;
|
|
|
|
/* FIXME: We should be getting this information */
|
|
|
|
app.supported_uri_schemes = NULL;
|
2000-08-09 06:23:46 +00:00
|
|
|
app.requires_terminal = FALSE;
|
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
if (update) {
|
2001-03-06 23:33:19 +00:00
|
|
|
original = gnome_vfs_mime_application_new_from_id (app.id);
|
2000-11-02 08:37:45 +00:00
|
|
|
if (original == NULL) {
|
|
|
|
const char *original_id;
|
|
|
|
GList *selection;
|
|
|
|
GtkListItem *item;
|
|
|
|
int position;
|
|
|
|
|
|
|
|
/* If there isn't a selection we cannot allow an edit */
|
|
|
|
selection = GTK_LIST (list)->selection;
|
|
|
|
if (selection == NULL || g_list_length (selection) <= 0) {
|
2001-03-06 23:33:19 +00:00
|
|
|
return NULL;
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get application id and info */
|
|
|
|
item = GTK_LIST_ITEM (selection->data);
|
|
|
|
if (item == NULL) {
|
2001-03-06 23:33:19 +00:00
|
|
|
return NULL;
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
original_id = gtk_object_get_data (GTK_OBJECT (item), "application_id");
|
|
|
|
if (original_id == NULL) {
|
2001-03-06 23:33:19 +00:00
|
|
|
return NULL;
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
2001-03-06 23:33:19 +00:00
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
/* Remove original application data */
|
|
|
|
gnome_vfs_application_registry_remove_mime_type (original_id, mime_type);
|
|
|
|
gnome_vfs_application_registry_sync ();
|
|
|
|
gnome_vfs_mime_remove_application_from_short_list (mime_type, original_id);
|
|
|
|
|
|
|
|
/* Remove widget from list */
|
|
|
|
position = gtk_list_child_position (GTK_LIST (list), GTK_WIDGET (item));
|
|
|
|
gtk_container_remove (GTK_CONTAINER (list), GTK_WIDGET (item));
|
|
|
|
|
|
|
|
/* Add new widget and restore position */
|
2001-03-06 23:33:19 +00:00
|
|
|
add_item_to_application_list (list, original_id, name, mime_type,
|
|
|
|
gnome_vfs_application_is_user_owned_application (original),
|
|
|
|
position);
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-09 06:23:46 +00:00
|
|
|
gnome_vfs_application_registry_save_mime_application (&app);
|
2001-03-06 23:33:19 +00:00
|
|
|
gnome_vfs_application_registry_add_mime_type (app.id, mime_type);
|
2000-08-09 06:23:46 +00:00
|
|
|
gnome_vfs_application_registry_sync ();
|
|
|
|
|
|
|
|
gnome_vfs_mime_add_application_to_short_list (mime_type, app.id);
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
return g_strdup (app.id);
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-06 23:33:19 +00:00
|
|
|
add_item_to_application_list (GtkWidget *list, const char *id, const char *name, const char *mime_type,
|
|
|
|
gboolean user_owned, int position)
|
2000-11-02 08:37:45 +00:00
|
|
|
{
|
2001-03-06 23:33:19 +00:00
|
|
|
GtkListItem *list_item;
|
|
|
|
GList *short_list;
|
2000-11-02 08:37:45 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
|
|
|
|
list_item = create_application_list_item (id, name, mime_type, user_owned, short_list);
|
|
|
|
gnome_vfs_mime_application_list_free (short_list);
|
|
|
|
|
|
|
|
insert_item (GTK_LIST (list), list_item, position);
|
|
|
|
gtk_list_select_child (GTK_LIST (list), GTK_WIDGET (list_item));
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_invalid_application_input (GtkWindow *parent_window, const char *name, const char *command)
|
|
|
|
{
|
|
|
|
char *message;
|
|
|
|
char *stripped_name;
|
|
|
|
GnomeDialog *error_dialog;
|
|
|
|
gboolean error_in_name;
|
|
|
|
|
|
|
|
message = NULL;
|
|
|
|
error_in_name = FALSE;
|
|
|
|
|
|
|
|
stripped_name = g_strstrip (g_strdup (name));
|
|
|
|
|
|
|
|
if (strlen (stripped_name) == 0) {
|
|
|
|
message = g_strdup (_("You must enter a name."));
|
|
|
|
error_in_name = TRUE;
|
|
|
|
} else if (strlen (command) == 0) {
|
|
|
|
message = g_strdup (_("You must enter a command."));
|
|
|
|
} else if (!gnome_vfs_is_executable_command_string (command)) {
|
|
|
|
if (command[0] == '/') {
|
|
|
|
/* FIXME: Should strip parameters off before using in this message. */
|
|
|
|
/* FIXME: Should use separate messages for doesn't exist/isn't executable. */
|
|
|
|
/* Both of these FIXMEs would need to handle quoting to work correctly,
|
|
|
|
* since otherwise a space might be part of path or separator before parameters.
|
|
|
|
*/
|
|
|
|
/* FIXME: Should use some line-wrapping technology a la nautilus-stock-dialogs.c */
|
|
|
|
message = g_strdup_printf
|
|
|
|
(_("\"%s\" does not exist or is not executable.\n"
|
|
|
|
"Check your spelling and make sure you have\n"
|
|
|
|
"the right permissions to execute this file."), command);
|
|
|
|
} else {
|
|
|
|
/* FIXME: Should strip parameters off before using in this message */
|
|
|
|
message = g_strdup_printf
|
|
|
|
(_("The command \"%s\" cannot be found.\n"
|
|
|
|
"You must use a command that can work from any command line."), command);
|
|
|
|
}
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
g_free (stripped_name);
|
|
|
|
|
|
|
|
if (message != NULL) {
|
|
|
|
error_dialog = GNOME_DIALOG (gnome_error_dialog_parented (message,
|
|
|
|
parent_window));
|
|
|
|
gtk_window_set_title (GTK_WINDOW (error_dialog),
|
|
|
|
error_in_name
|
|
|
|
? _("Bad Application Name")
|
|
|
|
: _("Bad Application Command"));
|
|
|
|
|
|
|
|
gnome_dialog_run (error_dialog);
|
|
|
|
g_free (message);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-11-02 08:37:45 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
return FALSE;
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
2001-03-06 23:33:19 +00:00
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
static void
|
2001-03-06 23:33:19 +00:00
|
|
|
run_edit_or_new_application_dialog (const char *mime_type, GtkWidget *list, GnomeVFSMimeApplication *application)
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
2001-03-06 23:33:19 +00:00
|
|
|
GtkWidget *app_entry, *command_entry;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
GtkWidget *label;
|
2000-06-22 18:59:42 +00:00
|
|
|
GtkWidget *behavior_frame, *frame_vbox;
|
2000-06-22 23:36:29 +00:00
|
|
|
GtkWidget *multiple_check_box, *uri_check_box;
|
2000-06-22 18:59:42 +00:00
|
|
|
GtkWidget *table;
|
2001-03-06 23:33:19 +00:00
|
|
|
gboolean initial_toggle_state;
|
|
|
|
const char *name;
|
|
|
|
const char *command;
|
|
|
|
int dialog_result;
|
|
|
|
gboolean entry_validated;
|
|
|
|
char *invalid_entry_message, *app_id;
|
|
|
|
|
|
|
|
g_assert (mime_type != NULL || application != NULL);
|
|
|
|
g_assert (GTK_IS_WIDGET (list));
|
|
|
|
|
|
|
|
dialog = gnome_dialog_new (
|
|
|
|
application == NULL
|
|
|
|
? _("Add Application")
|
|
|
|
: _("Edit Application"),
|
|
|
|
GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
|
|
|
|
|
|
|
|
/* FIXME: Dialog should be parented on Edit Applications dialog */
|
|
|
|
|
2000-06-22 18:59:42 +00:00
|
|
|
/* Create table */
|
2001-03-06 23:33:19 +00:00
|
|
|
table = gtk_table_new (4, 2, FALSE);
|
2000-06-22 18:59:42 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (dialog)->vbox), table);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
/* Application Name label and entry */
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
label = gtk_label_new (_("Application Name:"));
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
|
2000-06-22 18:59:42 +00:00
|
|
|
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
app_entry = gtk_entry_new ();
|
2000-06-22 18:59:42 +00:00
|
|
|
gtk_table_attach_defaults ( GTK_TABLE (table), app_entry, 1, 2, 0, 1);
|
2001-03-06 23:33:19 +00:00
|
|
|
if (application != NULL) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app_entry), application->name);
|
|
|
|
}
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
/* Application Command label and entry */
|
|
|
|
label = gtk_label_new (_("Application Command:"));
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
|
2000-06-22 23:36:29 +00:00
|
|
|
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
command_entry = gtk_entry_new ();
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), command_entry, 1, 2, 1, 2);
|
|
|
|
if (application != NULL) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (command_entry), application->command);
|
|
|
|
}
|
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
/* Open Behavior frame */
|
2000-06-22 18:59:42 +00:00
|
|
|
behavior_frame = gtk_frame_new (_("Open Behavior"));
|
More capplet work in progress. Modifying applet and code to support UI
2000-07-04 Gene Z. Ragan <gzr@eazel.com>
More capplet work in progress. Modifying applet and code
to support UI work done by Arlo.
* libgnomevfs/gnome-vfs-mime-handlers.c:
(gnome_vfs_mime_add_extension), (gnome_vfs_mime_remove_extension):
API changes to support new layout.
* libgnomevfs/gnome-vfs-mime-info.c:
* libgnomevfs/gnome-vfs-mime-info.h:
(gnome_vfs_mime_get_extensions_list),
(gnome_vfs_mime_get_extensions_string):
API changes to support new layout.
* mime-type-capplet/Makefile.am:
Added dependency to GdkPixbuf.
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(show_edit_components_dialog), (add_new_application),
(show_new_application_window), (show_edit_application_window):
API changes to support new layout.
* mime-type-capplet/nautilus-mime-type-capplet.c:
* mime-type-capplet/nautilus-mime-type-capplet.h:
(populate_extension_list), (extension_list_deselected),
(application_button_toggled), (viewer_button_toggled),
(icon_changed), (init_mime_capplet),
(nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_viewer_menu),
(edit_default_clicked),
(nautilus_mime_type_capplet_update_application_info),
(nautilus_mime_type_capplet_update_viewer_info),
(insert_mime_vals_into_clist), (create_mime_list_and_scroller),
(nautilus_mime_type_capplet_get_selected_item_mime_type),
(make_path), (pixmap_file):
API changes to support new layout.
2000-07-05 04:35:04 +00:00
|
|
|
gtk_table_attach_defaults ( GTK_TABLE (table), behavior_frame, 0, 2, 2, 3);
|
2000-06-22 18:59:42 +00:00
|
|
|
|
|
|
|
frame_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (behavior_frame), frame_vbox);
|
|
|
|
|
2000-06-22 23:36:29 +00:00
|
|
|
multiple_check_box = gtk_check_button_new_with_label (_("Can open multiple files"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (frame_vbox), multiple_check_box, FALSE, FALSE, 0);
|
2001-03-06 23:33:19 +00:00
|
|
|
initial_toggle_state = application == NULL
|
|
|
|
? FALSE
|
|
|
|
: application->can_open_multiple_files;
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (multiple_check_box), initial_toggle_state);
|
2000-06-22 18:59:42 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* FIXME bugzilla.eazel.com 6066: This needs to be three options now: "yes", "no", and "use uris for non-file locations" */
|
|
|
|
uri_check_box = gtk_check_button_new_with_label (_("Can open from URI"));
|
2000-06-22 23:36:29 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (frame_vbox), uri_check_box, FALSE, FALSE, 0);
|
2001-03-06 23:33:19 +00:00
|
|
|
initial_toggle_state = application == NULL
|
|
|
|
? FALSE
|
|
|
|
: application->expects_uris;
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (uri_check_box), initial_toggle_state);
|
|
|
|
|
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox);
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
|
|
|
/* Set focus to text entry widget */
|
2001-03-06 23:33:19 +00:00
|
|
|
gtk_widget_grab_focus (app_entry);
|
|
|
|
|
|
|
|
do {
|
|
|
|
dialog_result = gnome_dialog_run (GNOME_DIALOG (dialog));
|
|
|
|
entry_validated = FALSE;
|
More work on adding applications and extension.
2000-06-21 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(initialize_edit_applications_dialog),
(nautilus_mime_type_capplet_show_new_extension_window),
(add_new_application), (show_new_application_window):
More work on adding applications and extension.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (none_button_toggled),
(application_button_toggled), (component_button_toggled),
(init_mime_capplet),
(nautilus_mime_type_capplet_get_selected_item_mime_type):
Changed use of GtkFixed to use layout. Layout is now messy
again, but I should be able to get it looking right.
2000-06-21 07:32:44 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
if (dialog_result == GNOME_OK) {
|
2000-11-02 08:37:45 +00:00
|
|
|
name = gtk_entry_get_text (GTK_ENTRY (app_entry));
|
|
|
|
command = gtk_entry_get_text (GTK_ENTRY (command_entry));
|
2001-03-06 23:33:19 +00:00
|
|
|
|
|
|
|
invalid_entry_message = NULL;
|
|
|
|
|
|
|
|
if (!handle_invalid_application_input (GTK_WINDOW (dialog), name, command)) {
|
|
|
|
entry_validated = TRUE;
|
|
|
|
app_id = add_or_update_application (list,
|
|
|
|
name,
|
|
|
|
command,
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (multiple_check_box)),
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (uri_check_box)),
|
|
|
|
application != NULL);
|
|
|
|
if (application == NULL && app_id != NULL) {
|
|
|
|
add_item_to_application_list (list, app_id, name, mime_type, TRUE, -1);
|
|
|
|
}
|
|
|
|
g_free (app_id);
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
2001-03-06 23:33:19 +00:00
|
|
|
}
|
|
|
|
} while (dialog_result == GNOME_OK && !entry_validated);
|
|
|
|
|
|
|
|
/* FIXME: Close box is treated like Cancel, which loses user changes silently.
|
|
|
|
* Would be better to either do nothing at all (force use of OK or Cancel) or
|
|
|
|
* even put up a little dialog telling them they have to use OK or Cancel.
|
|
|
|
* Too bad we can't prevent the close box from appearing. Window Managers suck.
|
|
|
|
*/
|
|
|
|
if (dialog_result >= 0) {
|
|
|
|
gnome_dialog_close (GNOME_DIALOG (dialog));
|
|
|
|
}
|
2000-06-21 18:39:48 +00:00
|
|
|
}
|
2000-06-22 18:59:42 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
static void
|
|
|
|
show_new_application_window (GtkWidget *button, GtkWidget *list)
|
|
|
|
{
|
|
|
|
run_edit_or_new_application_dialog (gtk_object_get_data (GTK_OBJECT (button), "mime_type"), list, NULL);
|
|
|
|
}
|
|
|
|
|
2000-06-21 18:39:48 +00:00
|
|
|
static void
|
2000-11-02 08:37:45 +00:00
|
|
|
show_edit_application_window (GtkWidget *button, GtkWidget *list)
|
2000-06-21 18:39:48 +00:00
|
|
|
{
|
2000-11-02 08:37:45 +00:00
|
|
|
GList *selection;
|
|
|
|
const char *id;
|
|
|
|
GnomeVFSMimeApplication *application;
|
|
|
|
GtkListItem *item;
|
|
|
|
|
|
|
|
/* If there isn't a selection we cannot allow an edit */
|
|
|
|
selection = GTK_LIST (list)->selection;
|
|
|
|
if (selection == NULL || g_list_length (selection) <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get application id and info */
|
|
|
|
item = GTK_LIST_ITEM (selection->data);
|
|
|
|
if (item == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
2000-06-21 18:39:48 +00:00
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
id = gtk_object_get_data (GTK_OBJECT (item), "application_id");
|
|
|
|
if (id == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
application = gnome_vfs_mime_application_new_from_id (id);
|
|
|
|
if (application == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
run_edit_or_new_application_dialog (NULL, list, application);
|
2000-06-21 18:39:48 +00:00
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
gnome_vfs_mime_application_free (application);
|
2000-06-21 18:39:48 +00:00
|
|
|
}
|
2000-11-02 08:37:45 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
delete_selected_application (GtkWidget *button, GtkWidget *list)
|
|
|
|
{
|
|
|
|
GtkListItem *item;
|
2001-03-06 23:33:19 +00:00
|
|
|
const char *mime_type, *id;
|
2000-11-02 08:37:45 +00:00
|
|
|
GList *selection;
|
2000-07-30 18:30:39 +00:00
|
|
|
|
2000-11-02 08:37:45 +00:00
|
|
|
/* Get selected list item */
|
|
|
|
selection = GTK_LIST (list)->selection;
|
|
|
|
if (selection == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
item = GTK_LIST_ITEM (selection->data);
|
|
|
|
if (item == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
g_return_if_fail (GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "user_owned")));
|
|
|
|
|
|
|
|
id = gtk_object_get_data (GTK_OBJECT (item), "application_id");
|
2000-11-02 08:37:45 +00:00
|
|
|
mime_type = gtk_object_get_data (GTK_OBJECT (item), "mime_type");
|
|
|
|
|
2001-03-06 23:33:19 +00:00
|
|
|
/* Remove application if it is user owned */
|
|
|
|
if (id != NULL && mime_type != NULL) {
|
|
|
|
gnome_vfs_application_registry_remove_mime_type (id, mime_type);
|
2000-11-02 08:37:45 +00:00
|
|
|
gnome_vfs_application_registry_sync ();
|
2001-03-06 23:33:19 +00:00
|
|
|
gnome_vfs_mime_remove_application_from_short_list (mime_type, id);
|
2000-11-02 08:37:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove widget from list */
|
|
|
|
gtk_container_remove (GTK_CONTAINER (list), GTK_WIDGET (item));
|
|
|
|
}
|