gnome-control-center/capplets/file-types/new-mime-window.c
Gene Z. Ragan 1bdfaaac57 Work in progress for the modified Files and Programs capplet that is
2000-05-31  Gene Z. Ragan  <gzr@eazel.com>

	Work in progress for the modified Files and Programs
	capplet that is relacing the old mime types capplet
	in the Gnome Control Center.

	* mime-type-capplet/Makefile.am:
	Added link dependeny to libgnomevfs.

	* mime-type-capplet/edit-window.c:
	(add_extension), (remove_extension):
	Rename functions to be more coherent.

	(initialize_main_win), (initialize_main_win_vals):
	Modified functions to remove dialog items
	that are obsolete in our new designs.  Added new
	items such as the application and component menus.

	(populate_application_menu),
	(populate_component_menu), (application_menu_activate):
	Application menu functions that list the short
	list of applications for a mime type and allow a user
	to add applications to the short list.

	(add_application), (show_file_selector):
	Menu callback and function to display GtkFileSelection to
	allow user to locate an application to be associated with
	mime type.

	* mime-type-capplet/mime-data.c:
	(add_new_mime_type):
	Modified functions for new mime APIs.

	* mime-type-capplet/new-mime-window.c: (launch_new_mime_window):
	Modified functions for new mime APIs.

	* modules/file-method.c: (file_handle_new):
	Modified functions for new mime APIs.
2000-05-31 17:26:11 +00:00

73 lines
2.7 KiB
C

#include "new-mime-window.h"
#include "capplet-widget.h"
#include <config.h>
static GtkWidget *add_dialog = NULL;
extern GtkWidget *capplet;
/*Public functions */
void
launch_new_mime_window (void)
{
GtkWidget *mime_entry;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *ext_entry;
GtkWidget *hbox;
GtkWidget *vbox;
add_dialog = gnome_dialog_new (_("Add Mime Type"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
label = gtk_label_new (_("Add a new Mime Type\nFor example: image/tiff; text/x-scheme"));
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 (add_dialog)->vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (_("Mime Type:"));
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 (add_dialog)->vbox), hbox, FALSE, FALSE, 0);
frame = gtk_frame_new (_("Extensions"));
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (add_dialog)->vbox), frame, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
label = gtk_label_new (_("Type in the extensions for this mime-type.\nFor example: .html, .htm"));
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_container_add (GTK_CONTAINER (frame), vbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("Extension:")), FALSE, FALSE, 0);
ext_entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), ext_entry, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show_all (GNOME_DIALOG (add_dialog)->vbox);
switch (gnome_dialog_run (GNOME_DIALOG (add_dialog))) {
case 0:
capplet_widget_state_changed (CAPPLET_WIDGET (capplet),
TRUE);
add_new_mime_type (gtk_entry_get_text (GTK_ENTRY (mime_entry)),
gtk_entry_get_text (GTK_ENTRY (ext_entry)));
case 1:
gtk_widget_destroy (add_dialog);
default:;
}
add_dialog = NULL;
}
void
hide_new_mime_window (void)
{
if (add_dialog != NULL)
gtk_widget_hide (add_dialog);
}
void
show_new_mime_window (void)
{
if (add_dialog != NULL)
gtk_widget_show (add_dialog);
}