More work in progress and added a new file to the capplet build.
2000-06-13 Gene Z. Ragan <gzr@eazel.com> More work in progress and added a new file to the capplet build. * mime-type-capplet/nautilus-mime-type-capplet.c: (main), (init_mime_capplet), (edit_applications_clicked), (edit_components_clicked), (edit_application_dialog_destroy), (initialize_edit_application_dialog), (show_edit_applications_dialog), (show_edit_components_dialog): * mime-type-capplet/nautilus-mime-type-capplet.h: New file
This commit is contained in:
parent
53ce9946a6
commit
ee6dfffc70
2 changed files with 133 additions and 34 deletions
|
@ -45,29 +45,68 @@
|
||||||
#include "nautilus-mime-type-capplet.h"
|
#include "nautilus-mime-type-capplet.h"
|
||||||
|
|
||||||
|
|
||||||
/* Local Prototypes */
|
typedef struct {
|
||||||
static void populate_application_menu (GtkWidget *menu, const char *mime_string);
|
GtkWidget *window;
|
||||||
static void populate_component_menu (GtkWidget *menu, const char *mime_string);
|
} edit_application_dialog_details;
|
||||||
static void delete_mime_clicked (GtkWidget *widget, gpointer data);
|
|
||||||
static void add_mime_clicked (GtkWidget *widget, gpointer data);
|
|
||||||
static void edit_applications_clicked (GtkWidget *widget, gpointer data);
|
|
||||||
static void edit_components_clicked (GtkWidget *widget, gpointer data);
|
|
||||||
|
|
||||||
static void try_callback ();
|
|
||||||
static void revert_callback ();
|
/* Local Prototypes */
|
||||||
static void ok_callback ();
|
static void init_mime_capplet (void);
|
||||||
static void cancel_callback ();
|
static void populate_application_menu (GtkWidget *menu, const char *mime_string);
|
||||||
|
static void populate_component_menu (GtkWidget *menu, const char *mime_string);
|
||||||
|
static void delete_mime_clicked (GtkWidget *widget, gpointer data);
|
||||||
|
static void add_mime_clicked (GtkWidget *widget, gpointer data);
|
||||||
|
static void edit_applications_clicked (GtkWidget *widget, gpointer data);
|
||||||
|
static void edit_components_clicked (GtkWidget *widget, gpointer data);
|
||||||
|
|
||||||
|
static void try_callback (void);
|
||||||
|
static void revert_callback (void);
|
||||||
|
static void ok_callback (void);
|
||||||
|
static void cancel_callback (void);
|
||||||
#if 0
|
#if 0
|
||||||
static void help_callback ();
|
static void help_callback (void);
|
||||||
#endif
|
#endif
|
||||||
|
static void show_edit_applications_dialog (void);
|
||||||
|
static void show_edit_components_dialog (void);
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
|
static edit_application_dialog_details *edit_application_details = NULL;
|
||||||
|
|
||||||
GtkWidget *capplet = NULL;
|
GtkWidget *capplet = NULL;
|
||||||
GtkWidget *delete_button = NULL;
|
GtkWidget *delete_button = NULL;
|
||||||
GtkWidget *icon_entry, *extension_list, *mime_list;
|
GtkWidget *icon_entry, *extension_list, *mime_list;
|
||||||
GtkWidget *application_menu, *component_menu;
|
GtkWidget *application_menu, *component_menu;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* main
|
||||||
|
*
|
||||||
|
* Display capplet
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
int init_results;
|
||||||
|
|
||||||
|
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||||
|
textdomain (PACKAGE);
|
||||||
|
|
||||||
|
init_results = gnome_capplet_init("mime-type-capplet", VERSION,
|
||||||
|
argc, argv, NULL, 0, NULL);
|
||||||
|
|
||||||
|
if (init_results < 0) {
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (init_results == 0) {
|
||||||
|
init_mime_type ();
|
||||||
|
init_mime_capplet ();
|
||||||
|
capplet_gtk_main ();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
left_aligned_button (gchar *label)
|
left_aligned_button (gchar *label)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +156,7 @@ help_callback ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_mime_capplet ()
|
init_mime_capplet (void)
|
||||||
{
|
{
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *vbox, *hbox;
|
GtkWidget *vbox, *hbox;
|
||||||
|
@ -437,39 +476,69 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
||||||
static void
|
static void
|
||||||
edit_applications_clicked (GtkWidget *widget, gpointer data)
|
edit_applications_clicked (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
g_message ("edit_applications_clicked");
|
show_edit_applications_dialog ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_components_clicked (GtkWidget *widget, gpointer data)
|
edit_components_clicked (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
g_message ("edit_components_clicked");
|
show_edit_components_dialog ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
edit_application_dialog_destroy (GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
g_free (edit_application_details);
|
||||||
|
edit_application_details = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* initialize_edit_application_dialog
|
||||||
*
|
*
|
||||||
|
* Set up dialog for default application list editing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
static void
|
||||||
main (int argc, char **argv)
|
initialize_edit_application_dialog ()
|
||||||
|
{
|
||||||
|
edit_application_details = g_new0 (edit_application_dialog_details, 1);
|
||||||
|
edit_application_details->window = gnome_dialog_new ("",
|
||||||
|
GNOME_STOCK_BUTTON_OK,
|
||||||
|
GNOME_STOCK_BUTTON_CANCEL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (edit_application_details->window),
|
||||||
|
"destroy",
|
||||||
|
edit_application_dialog_destroy,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* show_edit_applications_dialog
|
||||||
|
*
|
||||||
|
* Setup and display edit application list dialog
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_edit_applications_dialog ()
|
||||||
|
{
|
||||||
|
if (edit_application_details == NULL) {
|
||||||
|
initialize_edit_application_dialog ();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(gnome_dialog_run (GNOME_DIALOG (edit_application_details->window))) {
|
||||||
|
case 0:
|
||||||
|
//apply_changes (mime_type);
|
||||||
|
/* Fall through */
|
||||||
|
case 1:
|
||||||
|
gtk_widget_hide (edit_application_details->window);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_edit_components_dialog ()
|
||||||
{
|
{
|
||||||
int init_results;
|
|
||||||
|
|
||||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
|
||||||
textdomain (PACKAGE);
|
|
||||||
|
|
||||||
init_results = gnome_capplet_init("mime-type-capplet", VERSION,
|
|
||||||
argc, argv, NULL, 0, NULL);
|
|
||||||
|
|
||||||
if (init_results < 0) {
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init_results == 0) {
|
|
||||||
init_mime_type ();
|
|
||||||
init_mime_capplet ();
|
|
||||||
capplet_gtk_main ();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
30
capplets/file-types/file-types-capplet.h
Normal file
30
capplets/file-types/file-types-capplet.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||||
|
/* nautilus-mime-type-capplet.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000 Free Software Foundaton
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Author: Gene Z. Ragan <gzr@eazel.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NAUTILUS_MIME_TYPE_CAPPLET_H
|
||||||
|
#define NAUTILUS_MIME_TYPE_CAPPLET_H
|
||||||
|
|
||||||
|
void nautilus_mime_type_capplet_update_info (const char *mime_type);
|
||||||
|
|
||||||
|
#endif /* NAUTILUS_MIME_TYPE_CAPPLET_H */
|
Loading…
Add table
Add a link
Reference in a new issue