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; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
|
|
|
|
|
|
|
/* new-mime-window.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2000 Eazel, Inc.
|
|
|
|
*
|
|
|
|
* This library 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 library 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 library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* Authors: Jonathan Blandford <jbr@redhat.com>
|
|
|
|
* Gene Z. Ragan <gzr@eazel.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
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
|
|
|
#include "new-mime-window.h"
|
|
|
|
#include "capplet-widget.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
|
|
|
|
|
|
|
|
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
|
|
|
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)),
|
2000-05-31 17:26:11 +00:00
|
|
|
gtk_entry_get_text (GTK_ENTRY (ext_entry)));
|
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
|
|
|
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);
|
|
|
|
}
|