Improve help handling.
2002-05-26 Jody Goldberg <jody@gnome.org> * capplet-util.c (capplet_help) : new utility. 2002-05-24 Jody Goldberg <jody@gnome.org> * mime-type-info.c (mime_category_info_load_all) : make this more paranoid. * mime-category-edit-dialog.c (update_subcategories) : Move this over here. 2002-05-17 Jody Goldberg <jody@gnome.org> * mime-type-info.c (mime_category_info_using_custom_app) : add some protection.
This commit is contained in:
parent
63d79cb52c
commit
49d1a5af36
12 changed files with 131 additions and 83 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-05-26 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* background-properties-capplet.c (cb_dialog_response) : improve
|
||||
handling of help failures.
|
||||
|
||||
Sun May 26 11:29:14 2002 Jonathan Blandford <jrb@gnome.org>
|
||||
|
||||
* background-properties-capplet.c (main): use APPID instead of
|
||||
|
|
|
@ -451,19 +451,11 @@ create_dialog (ApplierSet *set)
|
|||
static void
|
||||
cb_dialog_response (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_HELP) {
|
||||
GError *error = NULL;
|
||||
|
||||
/* TODO : get this written */
|
||||
gnome_help_display_desktop (NULL,
|
||||
"control-center-manual",
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
capplet_help (GTK_WINDOW (dialog),
|
||||
"config-background.xml",
|
||||
"CONFIGURATION", &error);
|
||||
if (error) {
|
||||
g_warning ("help error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
} else
|
||||
"CONFIGURATION");
|
||||
else
|
||||
gtk_main_quit ();
|
||||
}
|
||||
/* Callback issued during drag movements */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2002-05-26 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* capplet-util.c (capplet_help) : new utility.
|
||||
|
||||
2002-05-16 jacob berkman <jacob@ximian.com>
|
||||
|
||||
* gconf-property-editor.c (peditor_image_set_filename): if we
|
||||
|
|
|
@ -284,3 +284,42 @@ capplet_init (int argc,
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* capplet_help :
|
||||
* @parent :
|
||||
* @helpfile :
|
||||
* @section :
|
||||
*
|
||||
* A quick utility routine to display help for capplets, and handle errors in a
|
||||
* Havoc happy way.
|
||||
**/
|
||||
void
|
||||
capplet_help (GtkWindow *parent, char const *helpfile, char const *section)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_if_fail (helpfile != NULL);
|
||||
g_return_if_fail (section != NULL);
|
||||
|
||||
gnome_help_display_desktop (NULL,
|
||||
"control-center-manual",
|
||||
helpfile, section, &error);
|
||||
if (error) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("There was an error displaying help: %s"),
|
||||
error->message);
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog),
|
||||
"response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||
gtk_widget_show (dialog);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,4 +90,6 @@ void capplet_init (int argc,
|
|||
SetupPropertyEditorsFn setup_property_editors_fn,
|
||||
GetLegacySettingsFn get_legacy_settings_fn);
|
||||
|
||||
void capplet_help (GtkWindow *parent, char const *helpfile, char const *section);
|
||||
|
||||
#endif /* __CAPPLET_UTIL_H */
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2002-05-26 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* file-types-capplet.c (cb_file_type_dialog_response) : Improve
|
||||
handling of help failures.
|
||||
|
||||
2002-05-26 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* gnome-default-applications-properties.c (dialog_response) : improve
|
||||
handling of help failures.
|
||||
|
||||
Sun May 26 11:33:26 2002 Jonathan Blandford <jrb@gnome.org>
|
||||
|
||||
* gnome-default-applications-properties.c (main): use APPID
|
||||
|
|
|
@ -540,19 +540,11 @@ dialog_response (GtkDialog *widget,
|
|||
gint response_id,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_HELP) {
|
||||
GError *error = NULL;
|
||||
|
||||
/* TODO : get this written */
|
||||
gnome_help_display_desktop (NULL,
|
||||
"control-center-manual",
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
capplet_help (GTK_WINDOW (widget),
|
||||
"config-default-apps.xml",
|
||||
"CONFIGURATION", &error);
|
||||
if (error) {
|
||||
g_warning ("help error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
} else
|
||||
"CONFIGURATION");
|
||||
else
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2002-05-24 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* mime-type-info.c (mime_category_info_load_all) : make this more paranoid.
|
||||
* mime-category-edit-dialog.c (update_subcategories) : Move this over
|
||||
here.
|
||||
|
||||
2002-05-17 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
* mime-type-info.c (mime_category_info_using_custom_app) : add some
|
||||
protection.
|
||||
|
||||
2002-05-08 Jody Goldberg <jody@gnome.org>
|
||||
|
||||
http://bugzilla.gnome.org/show_bug.cgi?id=17728
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <glade/glade.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include "capplet-util.h"
|
||||
#include "mime-types-model.h"
|
||||
#include "mime-edit-dialog.h"
|
||||
#include "mime-category-edit-dialog.h"
|
||||
|
@ -42,8 +43,6 @@
|
|||
#include "service-edit-dialog.h"
|
||||
#include "service-info.h"
|
||||
|
||||
#define WID(x) (glade_xml_get_widget (dialog, x))
|
||||
|
||||
static void
|
||||
add_mime_cb (GtkButton *button, GladeXML *dialog)
|
||||
{
|
||||
|
@ -179,19 +178,11 @@ remove_cb (GtkButton *button, GladeXML *dialog)
|
|||
static void
|
||||
cb_file_type_dialog_response (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_HELP) {
|
||||
GError *error = NULL;
|
||||
|
||||
/* TODO : get this written */
|
||||
gnome_help_display_desktop (NULL,
|
||||
"control-center-manual",
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
capplet_help (GTK_WINDOW (dialog),
|
||||
"config-file-type.xml",
|
||||
"CONFIGURATION", &error);
|
||||
if (error) {
|
||||
g_warning ("help error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
} else
|
||||
"CONFIGURATION");
|
||||
else
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -343,13 +343,17 @@ populate_application_list (MimeCategoryEditDialog *dialog)
|
|||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_menu_item_new_with_label (_("Custom")));
|
||||
|
||||
if (found_idx < 0) {
|
||||
gboolean req_terminal = FALSE;
|
||||
found_idx = i;
|
||||
if (dialog->p->info->default_action != NULL) {
|
||||
if (dialog->p->info->default_action->command != NULL)
|
||||
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("program_entry")),
|
||||
dialog->p->info->default_action->command);
|
||||
req_terminal = dialog->p->info->default_action->requires_terminal;
|
||||
}
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("needs_terminal_toggle")),
|
||||
dialog->p->info->default_action->requires_terminal);
|
||||
req_terminal);
|
||||
} else {
|
||||
gtk_widget_set_sensitive (WID ("program_entry_box"), FALSE);
|
||||
}
|
||||
|
@ -363,6 +367,35 @@ populate_application_list (MimeCategoryEditDialog *dialog)
|
|||
update_sensitivity (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
update_subcategories (ModelEntry *entry, MimeCategoryInfo *category)
|
||||
{
|
||||
ModelEntry *tmp;
|
||||
|
||||
switch (entry->type) {
|
||||
case MODEL_ENTRY_MIME_TYPE:
|
||||
if (MIME_TYPE_INFO (entry)->use_category) {
|
||||
gnome_vfs_mime_application_free (MIME_TYPE_INFO (entry)->default_action);
|
||||
|
||||
if (category->default_action == NULL)
|
||||
MIME_TYPE_INFO (entry)->default_action = NULL;
|
||||
else
|
||||
MIME_TYPE_INFO (entry)->default_action = gnome_vfs_mime_application_copy (category->default_action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MODEL_ENTRY_CATEGORY:
|
||||
if (entry == MODEL_ENTRY (category) || MIME_CATEGORY_INFO (entry)->use_parent_category)
|
||||
for (tmp = entry->first_child; tmp != NULL; tmp = tmp->next)
|
||||
update_subcategories (tmp, category);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
store_data (MimeCategoryEditDialog *dialog)
|
||||
{
|
||||
|
@ -401,8 +434,7 @@ store_data (MimeCategoryEditDialog *dialog)
|
|||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("use_category_toggle")));
|
||||
|
||||
model_entry_save (MODEL_ENTRY (dialog->p->info));
|
||||
|
||||
mime_category_info_update (dialog->p->info);
|
||||
update_subcategories (MODEL_ENTRY (dialog->p->info), dialog->p->info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -357,7 +357,11 @@ mime_category_info_load_all (MimeCategoryInfo *category)
|
|||
|
||||
if (appid != NULL && *appid != '\0')
|
||||
category->default_action = gnome_vfs_application_registry_get_mime_application (appid);
|
||||
else
|
||||
|
||||
/* This must be non NULL, so be extra careful incase gnome-vfs
|
||||
* spits back a NULL
|
||||
*/
|
||||
if (category->default_action == NULL)
|
||||
category->default_action = g_new0 (GnomeVFSMimeApplication, 1);
|
||||
}
|
||||
|
||||
|
@ -382,7 +386,9 @@ mime_category_info_using_custom_app (const MimeCategoryInfo *category)
|
|||
gchar *tmp;
|
||||
gboolean ret;
|
||||
|
||||
if (category->default_action->name == NULL)
|
||||
if (category == NULL ||
|
||||
category->default_action == NULL ||
|
||||
category->default_action->name == NULL)
|
||||
return TRUE;
|
||||
|
||||
tmp = g_strdup_printf ("Custom %s", category->name);
|
||||
|
@ -471,41 +477,6 @@ mime_category_info_save (MimeCategoryInfo *category)
|
|||
set_subcategory_ids (MODEL_ENTRY (category), category, category->default_action->id);
|
||||
}
|
||||
|
||||
static void
|
||||
update_subcategories (ModelEntry *entry, MimeCategoryInfo *category)
|
||||
{
|
||||
ModelEntry *tmp;
|
||||
|
||||
switch (entry->type) {
|
||||
case MODEL_ENTRY_MIME_TYPE:
|
||||
if (MIME_TYPE_INFO (entry)->use_category) {
|
||||
gnome_vfs_mime_application_free (MIME_TYPE_INFO (entry)->default_action);
|
||||
|
||||
if (category->default_action == NULL)
|
||||
MIME_TYPE_INFO (entry)->default_action = NULL;
|
||||
else
|
||||
MIME_TYPE_INFO (entry)->default_action = gnome_vfs_mime_application_copy (category->default_action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MODEL_ENTRY_CATEGORY:
|
||||
if (entry == MODEL_ENTRY (category) || MIME_CATEGORY_INFO (entry)->use_parent_category)
|
||||
for (tmp = entry->first_child; tmp != NULL; tmp = tmp->next)
|
||||
update_subcategories (tmp, category);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mime_category_info_update (MimeCategoryInfo *info)
|
||||
{
|
||||
update_subcategories (MODEL_ENTRY (info), info);
|
||||
}
|
||||
|
||||
static GList *
|
||||
find_possible_supported_apps (ModelEntry *entry, gboolean top)
|
||||
{
|
||||
|
|
|
@ -107,7 +107,6 @@ MimeCategoryInfo *mime_category_info_new (MimeCategoryInfo *parent,
|
|||
void mime_category_info_load_all (MimeCategoryInfo *category);
|
||||
gboolean mime_category_info_using_custom_app (const MimeCategoryInfo *category);
|
||||
void mime_category_info_save (MimeCategoryInfo *category);
|
||||
void mime_category_info_update (MimeCategoryInfo *info);
|
||||
|
||||
GList *mime_category_info_find_apps (MimeCategoryInfo *info);
|
||||
gchar *mime_category_info_get_full_name (MimeCategoryInfo *info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue