Implement (program_sensitive_cb): Implement (response_cb): Call store_data

2002-01-11  Bradford Hovinen  <hovinen@ximian.com>

	* service-edit-dialog.c (store_data): Implement
	(program_sensitive_cb): Implement
	(response_cb): Call store_data if response_id is OK
	(service_edit_dialog_init): Connect toggled signal on
	run_program_toggle to program_sensitive_cb

	* mime-type-info.h: Add #include gnome-vfs-mime-info.h

	* service-edit-dialog.c (populate_app_list): Implement

	* mime-edit-dialog.c (populate_component_list): Make sure custom
	menu item is shown
This commit is contained in:
Bradford Hovinen 2002-01-11 14:17:40 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 44aca2c8c3
commit b097229244
7 changed files with 85 additions and 9 deletions

View file

@ -1,3 +1,18 @@
2002-01-11 Bradford Hovinen <hovinen@ximian.com>
* service-edit-dialog.c (store_data): Implement
(program_sensitive_cb): Implement
(response_cb): Call store_data if response_id is OK
(service_edit_dialog_init): Connect toggled signal on
run_program_toggle to program_sensitive_cb
* mime-type-info.h: Add #include gnome-vfs-mime-info.h
* service-edit-dialog.c (populate_app_list): Implement
* mime-edit-dialog.c (populate_component_list): Make sure custom
menu item is shown
2002-01-04 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am: Clean up

View file

@ -1,9 +1,16 @@
- Get icon name (esp. use of stock icons) working correctly
- Add categories to many types in MIME database
- Do dialog for Internet service
- Validation
- Talk to gnome-vfs people about categories, edit and print lines, custom line, gnome-vfs-mime-info.h install
- Do something better about custom-line (i.e. create a dummy app in the app register)
- Make MIME types tree accept double clicks
- Implement tree cascading
- Fix gnome_url_show
- Don't have a separate add extension dialog, just put it in the same dialog as everything else
- Save Internet service info
- Fill in list for Internet service apps
- Make add work
CVS Surgery
- Move file-types to gnome-control-center, rename ???
- Move default-apps to control-center-plus

View file

@ -331,7 +331,9 @@ populate_component_list (MimeEditDialog *dialog)
gtk_widget_show (menu_item);
}
gtk_menu_append (menu, gtk_menu_item_new_with_label (_("None")));
menu_item = gtk_menu_item_new_with_label (_("None"));
gtk_menu_append (menu, menu_item);
gtk_widget_show (menu_item);
if (found_idx < 0)
found_idx = i;

View file

@ -27,6 +27,7 @@
#include <gnome.h>
#include <bonobo.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
G_BEGIN_DECLS
@ -45,6 +46,8 @@ struct _MimeTypeInfo
gchar *custom_line;
gchar *edit_line;
gchar *print_line;
gboolean is_category;
};
MimeTypeInfo *mime_type_info_load (const gchar *mime_type);

View file

@ -65,7 +65,13 @@ static void service_edit_dialog_finalize (GObject *object);
static void fill_dialog (ServiceEditDialog *dialog);
static void populate_app_list (ServiceEditDialog *dialog);
static void response_cb (ServiceEditDialog *dialog);
static void store_data (ServiceEditDialog *dialog);
static void program_sensitive_cb (ServiceEditDialog *dialog,
GtkToggleButton *tb);
static void response_cb (ServiceEditDialog *dialog,
gint response_id);
GType
service_edit_dialog_get_type (void)
@ -116,6 +122,8 @@ service_edit_dialog_init (ServiceEditDialog *dialog, ServiceEditDialogClass *cla
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("service_edit_widget"), TRUE, TRUE, 0);
g_signal_connect_swapped (G_OBJECT (WID ("run_program_toggle")), "toggled", (GCallback) program_sensitive_cb, dialog);
g_signal_connect_swapped (G_OBJECT (dialog->p->dialog_win), "response", (GCallback) response_cb, dialog);
}
@ -245,9 +253,10 @@ fill_dialog (ServiceEditDialog *dialog)
if (dialog->p->info->protocol != NULL)
gtk_entry_set_text (GTK_ENTRY (WID ("protocol_entry")), dialog->p->info->protocol);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("look_at_content_toggle")), dialog->p->info->use_content);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("look_at_content_toggle")), !dialog->p->info->run_program);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("run_program_toggle")), dialog->p->info->run_program);
if (dialog->p->info->use_content && strcmp (dialog->p->info->protocol, "ftp"))
if (!dialog->p->info->run_program && strcmp (dialog->p->info->protocol, "ftp"))
gtk_widget_set_sensitive (WID ("program_frame"), FALSE);
if (dialog->p->info->custom_line != NULL)
@ -261,10 +270,50 @@ fill_dialog (ServiceEditDialog *dialog)
static void
populate_app_list (ServiceEditDialog *dialog)
{
GtkOptionMenu *option_menu;
GtkMenu *menu;
GtkWidget *item;
option_menu = GTK_OPTION_MENU (WID ("program_select"));
menu = GTK_MENU (gtk_menu_new ());
item = gtk_menu_item_new_with_label (_("Custom"));
gtk_widget_show (item);
gtk_menu_append (menu, item);
gtk_option_menu_set_menu (option_menu, GTK_WIDGET (menu));
}
static void
response_cb (ServiceEditDialog *dialog)
store_data (ServiceEditDialog *dialog)
{
g_free (dialog->p->info->description);
dialog->p->info->description = g_strdup (gtk_entry_get_text (GTK_ENTRY (WID ("description_entry"))));
dialog->p->info->run_program =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("run_program_toggle")));
g_free (dialog->p->info->custom_line);
dialog->p->info->custom_line =
g_strdup (gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (WID ("custom_program_entry")), FALSE));
}
static void
program_sensitive_cb (ServiceEditDialog *dialog, GtkToggleButton *tb)
{
if (gtk_toggle_button_get_active (tb))
gtk_widget_set_sensitive (WID ("program_frame"), TRUE);
else if (dialog->p->info == NULL || dialog->p->info->protocol == NULL ||
strcmp (dialog->p->info->protocol, "ftp"))
gtk_widget_set_sensitive (WID ("program_frame"), FALSE);
}
static void
response_cb (ServiceEditDialog *dialog, gint response_id)
{
if (response_id == GTK_RESPONSE_OK)
store_data (dialog);
g_object_unref (G_OBJECT (dialog));
}

View file

@ -124,7 +124,7 @@ service_info_load (const gchar *protocol, GConfChangeSet *changeset)
info = g_new0 (ServiceInfo, 1);
info->protocol = g_strdup (protocol);
info->description = get_string (info, "description", changeset);
info->use_content = get_bool (info, "use-content", changeset);
info->run_program = get_bool (info, "type", changeset);
info->custom_line = get_string (info, "command", changeset);
info->need_terminal = get_bool (info, "need-terminal", changeset);
@ -149,7 +149,7 @@ service_info_save (const ServiceInfo *info, GConfChangeSet *changeset)
set_string (info, "command-id", info->app->id, changeset);
}
set_bool (info, "use-content", info->use_content, changeset);
set_bool (info, "type", info->run_program, changeset);
set_bool (info, "need-terminal", info->need_terminal, changeset);
}

View file

@ -37,7 +37,7 @@ typedef struct _ServiceInfo ServiceInfo;
struct _ServiceInfo {
gchar *protocol;
gchar *description;
gboolean use_content;
gboolean run_program;
GnomeVFSMimeApplication *app;
gchar *custom_line;