Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
/* file-types-capplet.h
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Redhat Software Inc.
|
|
|
|
* Copyright (C) 2000 Free Software Foundaton
|
|
|
|
* Copyright (C) 2000 Eazel, Inc.
|
2002-01-08 21:25:33 +00:00
|
|
|
* Copyright (C) 2002 Ximian, Inc.
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2002-01-08 21:25:33 +00:00
|
|
|
* Authors: Jonathan Blandford <jrb@redhat.com>,
|
|
|
|
* Gene Z. Ragan <gzr@eazel.com>,
|
|
|
|
* Bradford Hovinen <hovinen@ximian.com>
|
mime-type-capplet/edit-window.c, mime-type-capplet/edit-window.h,
* Makefile.am:
* configure.in:
* mime-type-capplet/.cvsignore:
* mime-type-capplet/Makefile.am:
* mime-type-capplet/edit-window.c,
* mime-type-capplet/edit-window.h,
* mime-type-capplet/mime-data.c,
* mime-type-capplet/mime-data.h,
* mime-type-capplet/mime-info.c,
* mime-type-capplet/mime-info.h,
* mime-type-capplet/mime-type-capplet.c,
* mime-type-capplet/mime-type.desktop,
* mime-type-capplet/new-mime-window.c,
* mime-type-capplet/new-mime-window.h:
Copy mime-type capplet from the control-center so that it can be
improved and made to use gnome-vfs.
This has the unfortunate side-effect of introducing a dependency
on libcapplet. This is temporary until the capplet can move back
to the control-center. At that time, the control-center will
depend on gnome-vfs and eveyone will live happily ever after.
2000-05-23 23:23:57 +00:00
|
|
|
*/
|
2000-05-31 17:26:11 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
2001-07-25 04:51:23 +00:00
|
|
|
#endif
|
2000-07-08 00:57:36 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
#include <gnome.h>
|
|
|
|
#include <glade/glade.h>
|
2002-01-11 16:01:15 +00:00
|
|
|
#include <gconf/gconf-client.h>
|
2000-06-20 21:33:14 +00:00
|
|
|
|
2002-05-27 02:53:33 +00:00
|
|
|
#include "capplet-util.h"
|
2002-01-08 21:25:33 +00:00
|
|
|
#include "mime-types-model.h"
|
|
|
|
#include "mime-edit-dialog.h"
|
2002-01-14 15:28:36 +00:00
|
|
|
#include "mime-category-edit-dialog.h"
|
2002-01-08 21:25:33 +00:00
|
|
|
#include "mime-type-info.h"
|
|
|
|
#include "service-edit-dialog.h"
|
|
|
|
#include "service-info.h"
|
2000-06-20 21:33:14 +00:00
|
|
|
|
2000-11-16 04:53:55 +00:00
|
|
|
static void
|
2002-01-11 21:18:04 +00:00
|
|
|
add_mime_cb (GtkButton *button, GladeXML *dialog)
|
2000-11-16 04:53:55 +00:00
|
|
|
{
|
2002-01-25 16:12:01 +00:00
|
|
|
GtkTreeView *treeview;
|
|
|
|
GtkTreeModel *model;
|
2002-07-10 23:36:40 +00:00
|
|
|
GObject *add_dialog;
|
Fix bugs 2767 and 3228 add debugging functions. They are disabled by
2000-11-16 Mathieu Lacage <mathieu@eazel.com>
Fix bugs 2767 and 3228
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_stop_in_debugger),
(nautilus_stop_after_default_log_handler),
(nautilus_set_stop_after_default_log_handler),
(nautilus_make_warnings_and_criticals_stop_in_debugger),
add debugging functions. They are disabled by default.
(main), add call to debuggin funcitons if they are enabled.
(change_icon_clicked), implement.
(init_mime_capplet), tweaks, cleanups
(nautilus_mime_type_capplet_update_info), update icon.
(revert_mime_clicked), implement correctly.
(delete_mime_clicked), implement correctly.
(add_mime_clicked), cleanups
(capplet_get_icon_pixbuf), new function to get the pixbuf for
a given mime type
(populate_mime_list): use the new function above, refactor.
(update_mime_list_action): idem.
2000-11-16 08:33:02 +00:00
|
|
|
|
2002-01-25 16:12:01 +00:00
|
|
|
treeview = GTK_TREE_VIEW (WID ("mime_types_tree"));
|
|
|
|
model = gtk_tree_view_get_model (treeview);
|
|
|
|
|
2002-06-05 04:17:14 +00:00
|
|
|
add_dialog = mime_add_dialog_new (model,
|
2002-06-26 02:23:55 +00:00
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
|
|
|
|
NULL);
|
2002-01-25 16:12:01 +00:00
|
|
|
}
|
|
|
|
|
2002-01-26 16:24:45 +00:00
|
|
|
static void
|
|
|
|
add_service_cb (GtkButton *button, GladeXML *dialog)
|
|
|
|
{
|
|
|
|
GtkTreeView *treeview;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
|
|
|
treeview = GTK_TREE_VIEW (WID ("mime_types_tree"));
|
|
|
|
model = gtk_tree_view_get_model (treeview);
|
|
|
|
|
2002-08-01 18:21:46 +00:00
|
|
|
service_add_dialog_new (model);
|
2002-01-26 16:24:45 +00:00
|
|
|
}
|
|
|
|
|
2002-07-10 23:36:40 +00:00
|
|
|
static GObject *
|
2002-01-25 16:12:01 +00:00
|
|
|
launch_edit_dialog (GtkTreeModel *model, GtkTreeIter *iter)
|
|
|
|
{
|
|
|
|
ModelEntry *entry;
|
|
|
|
|
|
|
|
entry = MODEL_ENTRY_FROM_ITER (iter);
|
|
|
|
|
|
|
|
switch (entry->type) {
|
|
|
|
case MODEL_ENTRY_MIME_TYPE:
|
2002-01-26 16:24:45 +00:00
|
|
|
return mime_edit_dialog_new (model, MIME_TYPE_INFO (entry));
|
2002-01-25 16:12:01 +00:00
|
|
|
|
|
|
|
case MODEL_ENTRY_SERVICE:
|
2002-01-26 16:24:45 +00:00
|
|
|
return service_edit_dialog_new (model, SERVICE_INFO (entry));
|
2002-01-25 16:12:01 +00:00
|
|
|
|
2002-07-10 14:42:26 +00:00
|
|
|
#if 0
|
2002-01-25 16:12:01 +00:00
|
|
|
case MODEL_ENTRY_CATEGORY:
|
2002-01-26 16:24:45 +00:00
|
|
|
return mime_category_edit_dialog_new (model, MIME_CATEGORY_INFO (entry));
|
2002-07-10 14:42:26 +00:00
|
|
|
#endif
|
2002-01-25 16:12:01 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-11-17 00:41:44 +00:00
|
|
|
}
|
2000-11-16 04:53:55 +00:00
|
|
|
|
2000-11-17 00:41:44 +00:00
|
|
|
static void
|
2002-01-08 21:25:33 +00:00
|
|
|
edit_cb (GtkButton *button, GladeXML *dialog)
|
2000-11-17 00:41:44 +00:00
|
|
|
{
|
2002-01-08 21:25:33 +00:00
|
|
|
GtkTreeView *treeview;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkTreeIter iter;
|
Fix bugs 2767 and 3228 add debugging functions. They are disabled by
2000-11-16 Mathieu Lacage <mathieu@eazel.com>
Fix bugs 2767 and 3228
* mime-type-capplet/nautilus-mime-type-capplet.c:
(nautilus_stop_in_debugger),
(nautilus_stop_after_default_log_handler),
(nautilus_set_stop_after_default_log_handler),
(nautilus_make_warnings_and_criticals_stop_in_debugger),
add debugging functions. They are disabled by default.
(main), add call to debuggin funcitons if they are enabled.
(change_icon_clicked), implement.
(init_mime_capplet), tweaks, cleanups
(nautilus_mime_type_capplet_update_info), update icon.
(revert_mime_clicked), implement correctly.
(delete_mime_clicked), implement correctly.
(add_mime_clicked), cleanups
(capplet_get_icon_pixbuf), new function to get the pixbuf for
a given mime type
(populate_mime_list): use the new function above, refactor.
(update_mime_list_action): idem.
2000-11-16 08:33:02 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
treeview = GTK_TREE_VIEW (WID ("mime_types_tree"));
|
|
|
|
selection = gtk_tree_view_get_selection (treeview);
|
|
|
|
gtk_tree_selection_get_selected (selection, &model, &iter);
|
2000-09-17 03:15:40 +00:00
|
|
|
|
2002-01-25 16:12:01 +00:00
|
|
|
launch_edit_dialog (model, &iter);
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
}
|
|
|
|
|
2002-01-11 18:42:36 +00:00
|
|
|
static void
|
|
|
|
row_activated_cb (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GladeXML *dialog)
|
|
|
|
{
|
|
|
|
GtkTreeModel *model;
|
2002-01-25 16:12:01 +00:00
|
|
|
GtkTreeIter iter;
|
2002-01-11 18:42:36 +00:00
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (view);
|
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
2002-01-25 16:12:01 +00:00
|
|
|
launch_edit_dialog (model, &iter);
|
2002-01-11 18:42:36 +00:00
|
|
|
}
|
|
|
|
|
2002-01-11 21:13:51 +00:00
|
|
|
static void
|
2002-10-03 10:18:55 +00:00
|
|
|
selection_count_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gint *count)
|
2002-01-27 16:58:43 +00:00
|
|
|
{
|
|
|
|
if (MODEL_ENTRY_FROM_ITER (iter)->type != MODEL_ENTRY_SERVICES_CATEGORY &&
|
|
|
|
MODEL_ENTRY_FROM_ITER (iter)->type != MODEL_ENTRY_CATEGORY)
|
|
|
|
(*count)++;
|
|
|
|
}
|
|
|
|
|
2002-01-11 21:13:51 +00:00
|
|
|
static void
|
|
|
|
selection_changed_cb (GtkTreeSelection *selection, GladeXML *dialog)
|
|
|
|
{
|
2002-01-27 16:58:43 +00:00
|
|
|
gint count = 0;
|
2002-01-11 21:13:51 +00:00
|
|
|
|
2002-10-03 10:18:55 +00:00
|
|
|
gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc) selection_count_cb, &count);
|
2002-01-27 16:58:43 +00:00
|
|
|
|
2002-10-03 10:18:55 +00:00
|
|
|
gtk_widget_set_sensitive (WID ("edit_button"), count != 0);
|
|
|
|
gtk_widget_set_sensitive (WID ("remove_button"), count != 0);
|
2002-01-11 21:13:51 +00:00
|
|
|
}
|
|
|
|
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
static void
|
2002-01-08 21:25:33 +00:00
|
|
|
remove_cb (GtkButton *button, GladeXML *dialog)
|
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
|
|
|
{
|
2002-01-08 21:25:33 +00:00
|
|
|
GtkTreeView *treeview;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkTreeIter iter;
|
2002-01-25 20:27:10 +00:00
|
|
|
ModelEntry *entry;
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
treeview = GTK_TREE_VIEW (WID ("mime_types_tree"));
|
|
|
|
selection = gtk_tree_view_get_selection (treeview);
|
|
|
|
gtk_tree_selection_get_selected (selection, &model, &iter);
|
Work in progress on the File Types and Program capplet
2000-06-13 Gene Z. Ragan <gzr@eazel.com>
Work in progress on the File Types and Program capplet
* mime-type-capplet/edit-window.c: (initialize_main_win):
* mime-type-capplet/mime-data.c: (get_priority), (add_to_key),
(mime_fill_from_file), (add_mime_vals_to_clist),
(selected_row_callback), (create_mime_clist), (add_new_mime_type):
* mime-type-capplet/mime-data.h:
* mime-type-capplet/nautilus-mime-type-capplet.c:
(init_mime_capplet), (nautilus_mime_type_capplet_update_info),
(populate_application_menu), (populate_component_menu),
(free_mime_info), (delete_mime_clicked), (add_mime_clicked),
(edit_applications_clicked), (edit_components_clicked):
2000-06-14 01:50:59 +00:00
|
|
|
|
2002-01-25 20:27:10 +00:00
|
|
|
entry = MODEL_ENTRY_FROM_ITER (&iter);
|
2002-01-11 21:13:51 +00:00
|
|
|
|
2002-01-27 16:18:36 +00:00
|
|
|
model_entry_remove_child (entry->parent, entry, model);
|
2002-04-23 15:56:53 +00:00
|
|
|
model_entry_delete (entry);
|
2002-01-25 16:12:01 +00:00
|
|
|
|
2002-01-11 21:13:51 +00:00
|
|
|
selection_changed_cb (selection, dialog);
|
mime-type-capplet/edit-window.c, mime-type-capplet/edit-window.h,
* Makefile.am:
* configure.in:
* mime-type-capplet/.cvsignore:
* mime-type-capplet/Makefile.am:
* mime-type-capplet/edit-window.c,
* mime-type-capplet/edit-window.h,
* mime-type-capplet/mime-data.c,
* mime-type-capplet/mime-data.h,
* mime-type-capplet/mime-info.c,
* mime-type-capplet/mime-info.h,
* mime-type-capplet/mime-type-capplet.c,
* mime-type-capplet/mime-type.desktop,
* mime-type-capplet/new-mime-window.c,
* mime-type-capplet/new-mime-window.h:
Copy mime-type capplet from the control-center so that it can be
improved and made to use gnome-vfs.
This has the unfortunate side-effect of introducing a dependency
on libcapplet. This is temporary until the capplet can move back
to the control-center. At that time, the control-center will
depend on gnome-vfs and eveyone will live happily ever after.
2000-05-23 23:23:57 +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
|
|
|
|
2002-04-10 20:11:02 +00:00
|
|
|
static void
|
|
|
|
cb_file_type_dialog_response (GtkDialog *dialog, gint response_id)
|
|
|
|
{
|
2002-05-27 02:53:33 +00:00
|
|
|
if (response_id == GTK_RESPONSE_HELP)
|
|
|
|
capplet_help (GTK_WINDOW (dialog),
|
2002-05-29 04:14:29 +00:00
|
|
|
"wgoscustlookandfeel.xml",
|
|
|
|
"goscustdoc-7");
|
2002-05-27 02:53:33 +00:00
|
|
|
else
|
2002-04-10 20:11:02 +00:00
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
static GladeXML *
|
|
|
|
create_dialog (void)
|
2000-11-13 19:16:38 +00:00
|
|
|
{
|
2002-01-08 21:25:33 +00:00
|
|
|
GladeXML *dialog;
|
2000-11-13 19:16:38 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
GtkTreeModel *model;
|
2000-11-17 23:15:20 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
GtkWidget *treeview;
|
|
|
|
GtkCellRenderer *renderer;
|
|
|
|
GtkTreeViewColumn *column;
|
2002-01-11 21:13:51 +00:00
|
|
|
GtkTreeSelection *selection;
|
2000-11-13 19:16:38 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/file-types-properties.glade", "main_dialog", NULL);
|
2000-11-13 19:16:38 +00:00
|
|
|
|
2002-01-25 16:12:01 +00:00
|
|
|
model = GTK_TREE_MODEL (mime_types_model_new (FALSE));
|
2002-01-08 21:25:33 +00:00
|
|
|
treeview = WID ("mime_types_tree");
|
2000-11-13 19:16:38 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), model);
|
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
|
|
|
|
2002-01-29 13:29:30 +00:00
|
|
|
/* Icon/description column */
|
|
|
|
column = gtk_tree_view_column_new ();
|
2002-07-10 21:45:45 +00:00
|
|
|
gtk_tree_view_column_set_resizable (column, TRUE);
|
|
|
|
gtk_tree_view_column_set_title (column, _("Description"));
|
2002-01-29 13:29:30 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
renderer = gtk_cell_renderer_pixbuf_new ();
|
2002-01-29 13:29:30 +00:00
|
|
|
gtk_tree_view_column_pack_start (column, renderer, FALSE);
|
2002-07-10 21:45:45 +00:00
|
|
|
gtk_tree_view_column_set_attributes
|
|
|
|
(column, renderer, "pixbuf", MODEL_COLUMN_ICON, 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
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
/* Description column */
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2002-01-29 13:29:30 +00:00
|
|
|
gtk_tree_view_column_pack_start (column, renderer, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes
|
|
|
|
(column, renderer, "text", MODEL_COLUMN_DESCRIPTION, NULL);
|
2002-06-18 18:55:14 +00:00
|
|
|
g_object_set (G_OBJECT (treeview),
|
|
|
|
"search_column", MODEL_COLUMN_DESCRIPTION,
|
|
|
|
NULL);
|
2002-01-29 13:29:30 +00:00
|
|
|
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
|
|
|
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (treeview), column);
|
2000-11-13 23:33:57 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
/* Extensions column */
|
2002-07-10 21:45:45 +00:00
|
|
|
column = gtk_tree_view_column_new ();
|
|
|
|
gtk_tree_view_column_set_resizable (column, TRUE);
|
|
|
|
gtk_tree_view_column_set_title (column, _("Extensions"));
|
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
2002-07-10 21:45:45 +00:00
|
|
|
gtk_tree_view_column_pack_start (column, renderer, TRUE);
|
|
|
|
gtk_tree_view_column_set_attributes
|
|
|
|
(column, renderer, "text", MODEL_COLUMN_FILE_EXT, NULL);
|
|
|
|
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
2000-11-13 23:33:57 +00:00
|
|
|
|
2002-01-11 21:13:51 +00:00
|
|
|
gtk_widget_set_sensitive (WID ("edit_button"), FALSE);
|
2002-01-27 16:58:43 +00:00
|
|
|
gtk_widget_set_sensitive (WID ("remove_button"), FALSE);
|
2002-01-11 21:13:51 +00:00
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
|
|
|
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
|
|
|
|
2002-01-11 21:18:04 +00:00
|
|
|
g_signal_connect (G_OBJECT (WID ("add_mime_button")), "clicked", (GCallback) add_mime_cb, dialog);
|
2002-01-26 16:24:45 +00:00
|
|
|
g_signal_connect (G_OBJECT (WID ("add_service_button")), "clicked", (GCallback) add_service_cb, dialog);
|
2002-01-08 21:25:33 +00:00
|
|
|
g_signal_connect (G_OBJECT (WID ("edit_button")), "clicked", (GCallback) edit_cb, dialog);
|
|
|
|
g_signal_connect (G_OBJECT (WID ("remove_button")), "clicked", (GCallback) remove_cb, dialog);
|
2002-01-11 21:13:51 +00:00
|
|
|
g_signal_connect (G_OBJECT (selection), "changed", (GCallback) selection_changed_cb, dialog);
|
2000-11-13 23:33:57 +00:00
|
|
|
|
2002-01-11 18:42:36 +00:00
|
|
|
g_signal_connect (G_OBJECT (WID ("mime_types_tree")), "row-activated", (GCallback) row_activated_cb, dialog);
|
|
|
|
|
2002-04-10 20:11:02 +00:00
|
|
|
g_signal_connect (G_OBJECT (WID ("main_dialog")),
|
|
|
|
"response",
|
|
|
|
G_CALLBACK (cb_file_type_dialog_response), NULL);
|
2000-11-13 23:33:57 +00:00
|
|
|
|
2002-04-10 20:11:02 +00:00
|
|
|
return dialog;
|
Removed obsolete files.
2000-06-19 Gene Z. Ragan <gzr@eazel.com>
* mime-type-capplet/mime-data.c:
* mime-type-capplet/mime-data.h:
Removed obsolete files.
* mime-type-capplet/Makefile.am:
Removed above files from Makefile.
* libgnomevfs/gnome-vfs-mime-handlers.c:
* libgnomevfs/gnome-vfs-mime-handlers.h:
(gnome_vfs_mime_add_extension_to_mime_type):
New function. Add extension mapping to named mime type
and save to .mime file.
* libgnomevfs/gnome-vfs-mime-info.c:
* libgnomevfs/gnome-vfs-mime-info.h:
(load_mime_list_info_from),
(load_mime_type_info), (gnome_vfs_mime_get_extensions),
(gnome_vfs_mime_extension_list_free):
New function to deep free the list returned
by gnome_vfs_mime_get_extensions()
(gnome_vfs_mime_registered_mime_type_list_free),
New function to deep free the list returned
by gnome_vfs_mime_get_extensions()
(gnome_vfs_mime_commit_registered_types):
Public function to commit internal hash table
of mime data to disk.
(gnome_vfs_mime_set_registered_type_key):
This functions sets the key data for the registered mime
type's hash table.
(write_mime_data_foreach), (write_mime_data):
New functions to write out mime data from hash table.
* mime-type-capplet/nautilus-mime-type-capplet-dialogs.c:
(nautilus_mime_type_capplet_show_new_mime_window),
(nautilus_mime_type_capplet_show_new_extension_window):
Clean up work on dialogs.
* mime-type-capplet/nautilus-mime-type-capplet.c:
(ok_callback),
(populate_extension_list),
(nautilus_mime_type_capplet_add_extension),
(remove_extension_clicked), (init_mime_capplet),
(delete_mime_clicked), (create_mime_list_and_scroller),
(get_selected_item_mime_type):
Clean up work on main capplet view.
2000-06-19 23:12:18 +00:00
|
|
|
}
|
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
|
|
|
|
2002-01-28 02:56:07 +00:00
|
|
|
static void
|
|
|
|
dialog_done_cb (MimeEditDialog *dialog, gboolean done, MimeTypeInfo *info)
|
|
|
|
{
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2002-04-10 20:11:02 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
2000-07-28 23:07:34 +00:00
|
|
|
{
|
2002-06-26 02:23:55 +00:00
|
|
|
char const *mime_type = NULL;
|
|
|
|
char const *file_name = NULL;
|
2002-01-28 02:56:07 +00:00
|
|
|
GtkTreeModel *model;
|
2002-06-26 02:23:55 +00:00
|
|
|
GnomeProgram *program;
|
|
|
|
poptContext popt_ctxt = 0;
|
2000-07-28 23:07:34 +00:00
|
|
|
|
2002-02-27 22:15:07 +00:00
|
|
|
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
textdomain (GETTEXT_PACKAGE);
|
2000-07-28 23:07:34 +00:00
|
|
|
|
2002-06-26 02:23:55 +00:00
|
|
|
program = gnome_program_init ("gnome-file-types-properties",
|
|
|
|
VERSION, LIBGNOMEUI_MODULE,
|
|
|
|
argc, argv,
|
|
|
|
NULL);
|
|
|
|
g_object_get (G_OBJECT (program),
|
|
|
|
GNOME_PARAM_POPT_CONTEXT, &popt_ctxt,
|
|
|
|
NULL);
|
2002-01-28 02:56:07 +00:00
|
|
|
|
2002-06-26 02:23:55 +00:00
|
|
|
if (popt_ctxt) {
|
|
|
|
const gchar **startup_files = poptGetArgs (popt_ctxt);
|
2002-06-26 14:34:22 +00:00
|
|
|
if (startup_files != NULL) {
|
|
|
|
mime_type = startup_files [0];
|
|
|
|
if (mime_type != NULL)
|
|
|
|
file_name = startup_files [1];
|
2002-06-26 02:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
2000-07-28 23:07:34 +00:00
|
|
|
|
2002-01-28 02:56:07 +00:00
|
|
|
if (mime_type == NULL) {
|
2002-07-10 23:36:40 +00:00
|
|
|
GladeXML *dialog = create_dialog ();
|
|
|
|
GtkWidget *mime_dialog = WID ("main_dialog");
|
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (mime_dialog),
|
|
|
|
GTK_RESPONSE_CLOSE);
|
|
|
|
capplet_set_icon (mime_dialog, "gnome-ccmime.png");
|
|
|
|
gtk_widget_show_all (mime_dialog);
|
2002-01-28 02:56:07 +00:00
|
|
|
} else {
|
2002-07-10 21:45:45 +00:00
|
|
|
MimeTypeInfo *info = NULL;
|
2002-07-10 23:36:40 +00:00
|
|
|
GObject *mime_dialog;
|
2002-07-10 21:45:45 +00:00
|
|
|
|
2002-01-28 02:56:07 +00:00
|
|
|
model = GTK_TREE_MODEL (mime_types_model_new (FALSE));
|
2002-06-05 04:17:14 +00:00
|
|
|
if (strcmp (GNOME_VFS_MIME_TYPE_UNKNOWN, mime_type)) {
|
|
|
|
info = mime_type_info_new (mime_type, model);
|
|
|
|
mime_dialog = mime_edit_dialog_new (model, info);
|
2002-07-10 21:45:45 +00:00
|
|
|
} else
|
2002-06-26 02:23:55 +00:00
|
|
|
mime_dialog = mime_add_dialog_new (model, NULL, file_name);
|
2002-07-10 23:36:40 +00:00
|
|
|
g_signal_connect (mime_dialog,
|
2002-07-10 21:45:45 +00:00
|
|
|
"done", (GCallback) dialog_done_cb, info);
|
2002-01-28 02:56:07 +00:00
|
|
|
}
|
2000-08-02 09:18:18 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
gtk_main ();
|
2000-08-02 09:18:18 +00:00
|
|
|
|
2002-01-08 21:25:33 +00:00
|
|
|
return 0;
|
2000-08-02 09:18:18 +00:00
|
|
|
}
|