diff --git a/capplets/localization/ChangeLog b/capplets/localization/ChangeLog deleted file mode 100644 index 38e73127f..000000000 --- a/capplets/localization/ChangeLog +++ /dev/null @@ -1,11 +0,0 @@ -2007-06-26 Michael Terry - - * localization.desktop.in.in, Makefile.am, - gnome-localization-properties.c: Use icon theme instead of global - pixmaps dir for app icon. Closes bug #450777. - -2006-12-08 Kjartan Maraas - - * gnome-localization-properties.c: (languages_changed_cb), - (languages_sorted_cb), (fill_region_option_menu), (setup_dialog): - Plug some leaks. Bug #376949. diff --git a/capplets/localization/Makefile.am b/capplets/localization/Makefile.am deleted file mode 100644 index b9736cc81..000000000 --- a/capplets/localization/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -bin_PROGRAMS = gnome-localization-properties - -gnome_localization_properties_SOURCES = \ - gnome-localization-properties.c - -gnome_localization_properties_LDADD = \ - $(GNOMECC_CAPPLETS_LIBS) \ - $(LOCALIZATION_CAPPLET_LIBS) - -@INTLTOOL_DESKTOP_RULE@ - -gladedir = $(pkgdatadir)/glade -glade_DATA = gnome-localization-properties.glade - -icondir = $(datadir)/icons/hicolor/48x48/apps -dist_icon_DATA = localization-capplet.png - -desktopdir = $(datadir)/applications -desktop_in_files = localization.desktop.in -desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) - -INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) -CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) -EXTRA_DIST = $(glade_DATA) $(pixmaps_DATA) $(desktop_in_files) - -gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor -install-data-hook: update-icon-cache -uninstall-hook: update-icon-cache -update-icon-cache: - @-if test -z "$(DESTDIR)"; then \ - echo "Updating Gtk icon cache."; \ - $(gtk_update_icon_cache); \ - else \ - echo "*** Icon cache not updated. After (un)install, run this:"; \ - echo "*** $(gtk_update_icon_cache)"; \ - fi - diff --git a/capplets/localization/gnome-localization-properties.c b/capplets/localization/gnome-localization-properties.c deleted file mode 100644 index c7e9fddbd..000000000 --- a/capplets/localization/gnome-localization-properties.c +++ /dev/null @@ -1,1109 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* gnome-localization-properties.c - * Copyright (C) 2003 Carlos Perelló Marín - * - * Written by: Carlos Perelló Marín - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "capplet-util.h" -#include "gconf-property-editor.h" -#include "activate-settings-daemon.h" -#include "capplet-stock-icons.h" - -gboolean our_update; -gint idx2Select = -1; - -#define GCONF_LOCALIZATION_ROOT_KEY "/desktop/gnome/interface" - -#define get_selected_languages_list() \ - gconf_client_get_list (gconf_client_get_default (), \ - GCONF_LOCALIZATION_ROOT_KEY "/languages", \ - GCONF_VALUE_STRING, NULL) - -#define set_selected_languages_list(list) \ - gconf_client_set_list (gconf_client_get_default (), \ - GCONF_LOCALIZATION_ROOT_KEY "/languages", \ - GCONF_VALUE_STRING, (list), NULL) - -#define ICU_STRING_LONG 128 - -static void fill_region_option_menu (GladeXML *dialog); - -static GladeXML * -create_dialog (void) -{ - GladeXML *dialog; - - dialog = glade_xml_new - (GNOMECC_GLADE_DIR "/gnome-localization-properties.glade", - NULL, NULL); - - return dialog; -} - -static void -enable_disable_move_buttons_cb (GladeXML *dialog) -{ - GtkWidget *up_button; - GtkWidget *down_button; - GtkWidget *tree_view; - GtkTreeSelection *selection; - GtkTreeIter iter; - GtkTreeModel *model; - gboolean can_move_up; - gboolean can_move_down; - int nlangs; - - up_button = WID ("language_up_button"); - down_button = WID ("language_down_button"); - tree_view = WID ("languages_treeview"); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); - model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); - nlangs = gtk_tree_model_iter_n_children (model, NULL); - - can_move_up = FALSE; - can_move_down = FALSE; - - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - GtkTreePath *path = - gtk_tree_model_get_path (model, &iter); - if (path != NULL) { - int *indices = gtk_tree_path_get_indices (path); - int idx = indices[0]; - can_move_up = idx > 0; - can_move_down = idx < (nlangs - 1); - gtk_tree_path_free (path); - } - } - gtk_widget_set_sensitive (up_button, can_move_up); - gtk_widget_set_sensitive (down_button, can_move_down); -} - -static void -prepare_selected_languages_tree (GladeXML * dialog) -{ - GtkListStore *list_store; - GtkWidget *tree_view; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - GtkTreeSelection *selection; - - list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); - tree_view = WID ("languages_treeview"); - renderer = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes (NULL, - renderer, "text", 0, NULL); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); - g_signal_connect_swapped (G_OBJECT (selection), "changed", - G_CALLBACK - (enable_disable_move_buttons_cb), - dialog); - - - gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), - GTK_TREE_MODEL (list_store)); - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); -} - -static void -item_toggled_cb (GtkCellRendererToggle *cell, - gchar *path_str, - GtkTreeModel *model) -{ - GtkTreePath *path; - GtkTreeIter iter; - gboolean toggle_item; - - path = gtk_tree_path_new_from_string (path_str); - - /* get toggled iter */ - gtk_tree_model_get_iter (model, &iter, path); - gtk_tree_model_get (model, &iter, 0, &toggle_item, -1); - - /* do something with the value */ - toggle_item ^= 1; - - /* set new value */ - gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, - toggle_item, -1); - - /* clean up */ - gtk_tree_path_free (path); -} - -static void -prepare_available_languages_tree (GladeXML *dialog) -{ - GtkTreeStore *tree_store; - GtkWidget *tree_view; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - - tree_store = gtk_tree_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_BOOLEAN); - tree_view = WID ("available_languages_treeview"); - - gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), - GTK_TREE_MODEL (tree_store)); - - /* Toggle Button */ - renderer = gtk_cell_renderer_toggle_new (); - g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); - g_signal_connect (G_OBJECT (renderer), "toggled", - G_CALLBACK (item_toggled_cb), tree_store); - column = gtk_tree_view_column_new_with_attributes (_("Show"), - renderer, "active", 0, "visible", 3, NULL); - - gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), - GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); - - /* Language tree */ - renderer = gtk_cell_renderer_text_new (); - g_object_set (renderer, "xalign", 0.0, NULL); - column = gtk_tree_view_column_new_with_attributes (_("Language"), - renderer, "text", 1, NULL); - - gtk_tree_view_column_set_sort_column_id (column, 1); - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); - - gtk_tree_view_set_expander_column (GTK_TREE_VIEW (tree_view), column); -} - -static void -fill_selected_languages_tree (GladeXML * dialog) -{ - GSList *langs; - GSList *cur_lang; - GtkListStore *list_store; - gchar *locale; - gchar *plocale; - gchar *split; - - list_store = GTK_LIST_STORE (gtk_tree_view_get_model - (GTK_TREE_VIEW (WID ("languages_treeview")))); - gtk_list_store_clear (list_store); - - langs = get_selected_languages_list (); - - if (langs == NULL) { /* We get the environment preferences */ - locale = g_strdup (setlocale (LC_MESSAGES, NULL)); - plocale = locale; - while (locale != NULL) { - split = strchr (locale, ':'); - if (split) { - *split = '\0'; - split++; - } - langs = g_slist_append (langs, locale); - locale = split; - } - g_free (plocale); - - if (langs) { - set_selected_languages_list (langs); - } - } - - for (cur_lang = langs; cur_lang != NULL; cur_lang = cur_lang->next) { - GtkTreeIter iter; - gunichar2 name[ICU_STRING_LONG]; - gchar *name_utf8; - UErrorCode status; - - locale = (char *) cur_lang->data; - status = U_ZERO_ERROR; - - uloc_getDisplayName (locale, locale, name, - ICU_STRING_LONG, &status); - /* Change the first letter to uppercase */ - name[0] = g_unichar_toupper (name[0]); - name_utf8 = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL); - - gtk_list_store_append (list_store, &iter); - - gtk_list_store_set (list_store, &iter, - 0, name_utf8 ? name_utf8 : locale, - 1, locale, -1); - g_free (name_utf8); - } - if (idx2Select != -1) { - GtkTreeSelection *selection; - GtkTreePath *path; - - selection = gtk_tree_view_get_selection ((GTK_TREE_VIEW - (WID ("languages_treeview")))); - path = gtk_tree_path_new_from_indices (idx2Select, -1); - gtk_tree_selection_select_path (selection, path); - gtk_tree_path_free (path); - idx2Select = -1; - } - enable_disable_move_buttons_cb (dialog); -} - -static void -fill_available_languages_tree (GladeXML *dialog) -{ - GtkTreeStore *tree_store; - gint32 nlocales; - gint32 i; - GSList *langs; - - tree_store = GTK_TREE_STORE (gtk_tree_view_get_model - (GTK_TREE_VIEW (WID ("available_languages_treeview")))); - gtk_tree_store_clear (tree_store); - - nlocales = uloc_countAvailable (); - langs = get_selected_languages_list (); - - for (i = 0; i < nlocales; i++) { - UErrorCode status; - const gchar *locale; - gunichar2 name[ICU_STRING_LONG]; - gchar *name_utf8; - GtkTreeIter iter; - GtkTreeIter child_iter; - - status = U_ZERO_ERROR; - locale = uloc_getAvailable (i); - if (uloc_getVariant (locale, NULL, 0, &status)) { - continue; /* We don't handle the variant locales */ - } - - status = U_ZERO_ERROR; - - if (!uloc_getCountry (locale, NULL, 0, &status)) { - - uloc_getDisplayLanguage (locale, locale, name, - ICU_STRING_LONG, &status); - name[0] = g_unichar_toupper (name[0]); - name_utf8 = g_utf16_to_utf8 (name, -1, - NULL, NULL, NULL); - - gtk_tree_store_append (tree_store, &iter, NULL); - if (g_slist_find_custom - (langs, locale, (GCompareFunc) strcmp)) { - gtk_tree_store_set (tree_store, &iter, - 0, TRUE, 1, name_utf8, - 2, locale, 3, TRUE, -1); - } else { - gtk_tree_store_set (tree_store, &iter, - 0, FALSE, 1, name_utf8, - 2, locale, 3, TRUE, -1); - } - } else { - status = U_ZERO_ERROR; - - uloc_getDisplayCountry (locale, locale, name, - ICU_STRING_LONG, &status); - name_utf8 = g_utf16_to_utf8 (name, -1, - NULL, NULL, NULL); - - gtk_tree_store_append (tree_store, &child_iter, &iter); - if (g_slist_find_custom - (langs, locale, (GCompareFunc) strcmp)) { - gtk_tree_store_set (tree_store, &child_iter, - 0, TRUE, 1, name_utf8, - 2, locale, 3, TRUE, -1); - } else { - gtk_tree_store_set (tree_store, &child_iter, - 0, FALSE, 1, name_utf8, - 2, locale, 3, TRUE, -1); - } - } - } -} - -static void -update_warning_box (GladeXML *dialog) -{ - GtkWidget *warning; - - warning = WID ("warning_hbox"); - gtk_widget_show (warning); -} - -static void -update_info_box (GladeXML *dialog, const gchar *lang, const gchar *region) -{ - GtkWidget *info; - gchar main_lang[5]; - gchar region_lang[5]; - UErrorCode status; - - info = WID ("info_hbox"); - - if (lang == NULL || region == NULL) { - gtk_widget_show (info); - return; - } - status = U_ZERO_ERROR; - uloc_getLanguage (lang, main_lang, 5, &status); - uloc_getLanguage (region, region_lang, 5, &status); - - if (strcmp (main_lang, region_lang)) { - gtk_widget_show (info); - } else { - gtk_widget_hide (info); - } - -} - -static void -languages_changed_cb (GConfClient *client, guint cnxn_id, - GConfEntry *entry, GladeXML *dialog) -{ - GSList *langs; - const gchar *region; - - if (our_update) { - our_update = FALSE; - } else { - fill_selected_languages_tree (dialog); - fill_available_languages_tree (dialog); - } - langs = gconf_value_get_list (entry->value); - region = gconf_client_get_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", NULL); - - update_warning_box (dialog); - update_info_box (dialog, langs->data, region); - g_free (region); - - fill_region_option_menu (dialog); -} - -static void -languages_sorted_cb (GtkWidget *widget, - GdkDragContext *context, - GladeXML *dialog) -{ - GSList *old_langs; - GSList *new_langs; - GtkWidget *tree_view; - GtkTreeModel *model; - GtkTreeIter iter; - gboolean changed, more_rows; - gchar *code; - guint len, i; - const gchar *region; - - tree_view = WID ("languages_treeview"); - model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); - - old_langs = get_selected_languages_list (); - new_langs = NULL; - len = g_slist_length (old_langs); - changed = FALSE; - if (gtk_tree_model_get_iter_first (model, &iter)) { - more_rows = TRUE; - for (i = 0; i < len && more_rows; i++) { - gtk_tree_model_get (model, &iter, 1, &code, -1); - if (strcmp (code, (const gchar *)g_slist_nth_data (old_langs, i))) { - changed = TRUE; - } - new_langs = g_slist_append (new_langs, code); - more_rows = gtk_tree_model_iter_next (model, &iter); - } - if (changed) { - our_update = TRUE; - set_selected_languages_list (new_langs); - enable_disable_move_buttons_cb (dialog); - - region = gconf_client_get_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", NULL); - - update_warning_box (dialog); - update_info_box (dialog, new_langs->data, region); - g_free (region); - } - } -} - -static void -change_languages_cb (GtkWidget *button, GladeXML *dialog) -{ - GtkWidget *chooser; - GtkWidget *main_capplet; - - chooser = WID ("available_languages_dialog"); - main_capplet = WID ("localization_dialog"); - - gtk_window_set_transient_for (GTK_WINDOW (chooser), - GTK_WINDOW (main_capplet)); - if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_OK) { - GSList *langs; - GSList *cur_lang; - GtkWidget *tree_view; - GtkTreeModel *model; - GtkTreeIter iter; - GtkTreeIter child_iter; - gboolean selected, changed; - gchar *code; - - tree_view = WID ("available_languages_treeview"); - model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); - - changed = FALSE; - if (gtk_tree_model_get_iter_first (model, &iter)) { - langs = get_selected_languages_list (); - do { - gtk_tree_model_get (model, &iter, - 0, &selected, 2, &code, -1); - cur_lang = g_slist_find_custom (langs, - code, (GCompareFunc) strcmp); - - if (cur_lang && !selected) { - langs = g_slist_delete_link - (langs, cur_lang); - changed = TRUE; - } else if (!cur_lang && selected) { - langs = g_slist_append - (langs, code); - changed = TRUE; - } else { - g_free (code); - } - if (gtk_tree_model_iter_children - (model, &child_iter, &iter)) { - do { - gtk_tree_model_get (model, - &child_iter, - 0, &selected, - 2, &code, -1); - cur_lang = g_slist_find_custom - (langs, code, - (GCompareFunc) strcmp); - - if (cur_lang && !selected) { - langs = g_slist_delete_link - (langs, cur_lang); - changed = TRUE; - } else if (!cur_lang && selected) { - langs = g_slist_append - (langs, code); - changed = TRUE; - } else { - g_free (code); - } - } while (gtk_tree_model_iter_next (model, &child_iter)); - } - } while (gtk_tree_model_iter_next (model, &iter)); - } - if (changed) { - set_selected_languages_list (langs); - } - gtk_widget_hide (chooser); - } else { - gtk_widget_hide (chooser); - } -} - -static void -language_move (GladeXML * dialog, int offset) -{ - GtkTreeSelection *selection; - GtkTreeIter siter; - GtkTreeModel *model; - GSList *langs; - GtkTreePath *path; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW - (WID ("languages_treeview"))); - - if (gtk_tree_selection_get_selected (selection, &model, &siter)) { - path = gtk_tree_model_get_path (model, &siter); - if (path != NULL) { - int *indices; - char *id; - GSList *node; - - id = NULL; - - langs = get_selected_languages_list (); - indices = gtk_tree_path_get_indices (path); - node = g_slist_nth (langs, indices[0]); - - langs = g_slist_remove_link (langs, node); - - id = (char *) node->data; - g_slist_free_1 (node); - - langs = g_slist_insert (langs, id, indices[0] + offset); - idx2Select = indices[0] + offset; - - set_selected_languages_list (langs); - gtk_tree_path_free (path); - } - } -} - -static void -language_up_cb (GtkWidget *button, GladeXML *dialog) -{ - language_move (dialog, -1); -} - -static void -language_down_cb (GtkWidget *button, GladeXML *dialog) -{ - language_move (dialog, +1); -} - -static void -menu_item_activated_cb (GtkMenuItem *menu_item, GladeXML *dialog) -{ - const gchar *locale; - - locale = g_object_get_data (G_OBJECT (menu_item), "itemId"); - gconf_client_set_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", - locale, NULL); -} - -static void -submenu_selected_cb (GtkMenu *menu, GladeXML *dialog) -{ - GtkWidget *menu_item; - GtkWidget *optionmenu; - const gchar *locale; - - optionmenu = WID ("region_optionmenu"); - menu_item = gtk_menu_get_active (menu); - locale = g_object_get_data (G_OBJECT (menu_item), "itemId"); - gconf_client_set_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", - locale, NULL); - fill_region_option_menu (dialog); -// gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 0); -} - -static void -update_region_examples (GladeXML *dialog, const gchar *region) -{ - UErrorCode status; - gunichar2 str[ICU_STRING_LONG]; - gchar *str_utf8; - UCalendar *cal; - UDate date; - GtkWidget *label; - UDateFormat* dfmt; - UNumberFormat* nf; - double number; - - status = U_ZERO_ERROR; - - cal = ucal_open (NULL, -1, region, UCAL_TRADITIONAL, &status); - ucal_setDateTime (cal, 2004, UCAL_JANUARY, 2, 12, 34, 0, &status); - date = ucal_getMillis (cal, &status); - - /* Full date label */ - status = U_ZERO_ERROR; - dfmt = udat_open(UDAT_NONE, UDAT_FULL, region, - NULL, -1, NULL, -1, &status); - udat_format(dfmt, date, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("full_date_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); - - /* Medium date label */ - status = U_ZERO_ERROR; - dfmt = udat_open(UDAT_NONE, UDAT_MEDIUM, region, - NULL, -1, NULL, -1, &status); - udat_format(dfmt, date, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("medium_date_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); - - /* Short date label */ - status = U_ZERO_ERROR; - dfmt = udat_open(UDAT_NONE, UDAT_SHORT, region, - NULL, -1, NULL, -1, &status); - udat_format(dfmt, date, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("short_date_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); - - /* Short time AM label */ - status = U_ZERO_ERROR; - dfmt = udat_open(UDAT_SHORT, UDAT_NONE, region, - NULL, -1, NULL, -1, &status); - udat_format(dfmt, date, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("am_time_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); - - /* Short time AM label */ - status = U_ZERO_ERROR; - ucal_setDateTime (cal, 2004, UCAL_JANUARY, 2, 4, 56, 0, &status); - date = ucal_getMillis (cal, &status); - dfmt = udat_open(UDAT_SHORT, UDAT_NONE, region, - NULL, -1, NULL, -1, &status); - udat_format(dfmt, date, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("pm_time_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); - - /* Currency label */ - number = 1234.56; - status = U_ZERO_ERROR; - nf = unum_open(UNUM_CURRENCY, NULL, -1, region, NULL, &status); - unum_formatDouble(nf, number, str, ICU_STRING_LONG, NULL, &status); - str_utf8 = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL); - label = WID ("currency_label"); - gtk_label_set_text (GTK_LABEL(label), str_utf8); - g_free (str_utf8); -} - -static void -fill_region_option_menu (GladeXML *dialog) -{ - GSList *langs; - gchar main_lang[5]; - UErrorCode status; - const gchar *selected_region; - GtkWidget *menu; - GtkWidget *submenu; - GtkWidget *menu_item; - gboolean show_all; - gint32 nlocales; - gint32 i; - gboolean has_childs; - gboolean selected_region_added; - GtkWidget *selected_region_mitem; - GList *pitem_node; - gint position; - - langs = get_selected_languages_list (); - status = U_ZERO_ERROR; - - uloc_getLanguage ((gchar *)langs->data, main_lang, 5, &status); - selected_region = gconf_client_get_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", NULL); - - if (selected_region == NULL) { /* We get the environment preferences */ - selected_region = setlocale (LC_TIME, NULL); - if (selected_region) { - gconf_client_set_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", - selected_region, NULL); - return; /* The GConf event will update the menu */ - } else { - /* FIXME: What default should we use? */ - selected_region = (gchar *) langs->data; - } - } - selected_region_added = FALSE; - selected_region_mitem = NULL; - - show_all = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON - (WID ("show_all_checkbutton"))); - - /* FIXME: Is there a way to reuse the old menu? */ - menu = gtk_menu_new (); - submenu = NULL; - menu_item = NULL; - - nlocales = uloc_countAvailable (); - has_childs = FALSE; - - for (i = 0; i < nlocales; i++) { - const gchar *locale; - gunichar2 name[ICU_STRING_LONG]; - gchar *name_utf8; - gint position; - - locale = uloc_getAvailable (i); - - if (uloc_getVariant (locale, NULL, 0, &status)) { - continue; /* We don't handle the variant locales */ - } - - status = U_ZERO_ERROR; - - if (!uloc_getCountry (locale, NULL, 0, &status)) { - /* We remove the last country submenu - * if it does not have childs - */ - if (!has_childs && menu_item) { - gtk_menu_item_remove_submenu - (GTK_MENU_ITEM (menu_item)); - g_signal_connect - (menu_item, "activate", - G_CALLBACK (menu_item_activated_cb), - dialog); - } - - /* If it's the main language selected - * we just add their childs to the root menu - */ - if (strcmp (locale, main_lang) == 0 && - strcmp ((gchar *)langs->data, - main_lang)) { - has_childs = TRUE; - submenu = menu; - continue; - } else if (!show_all) { - has_childs = TRUE; - submenu = NULL; - continue; - } - - status = U_ZERO_ERROR; - uloc_getDisplayLanguage (locale, (gchar *)langs->data, - name, ICU_STRING_LONG, &status); - name[0] = g_unichar_toupper (name[0]); - name_utf8 = g_utf16_to_utf8 (name, -1, - NULL, NULL, NULL); - - if (selected_region_added) { - position = 2; - } else { - position = 0; - } - pitem_node = g_list_nth (GTK_MENU_SHELL (menu)->children, - position); - - for (position = selected_region_added ? 2 : 0; - pitem_node != NULL; - position++, - pitem_node = pitem_node->next) { - GtkWidget *label; - const gchar *plocale; - const gchar *txt; - - menu_item = GTK_WIDGET (pitem_node->data); - - plocale = g_object_get_data - (G_OBJECT (menu_item), "itemId"); - - status = U_ZERO_ERROR; - if (!uloc_getCountry (plocale, NULL, 0, &status)) { - label = GTK_BIN (menu_item)->child; - txt = gtk_label_get_text (GTK_LABEL (label)); - - /* FIXME: We must call setlocale */ - if (g_utf8_collate (txt, name_utf8) > 0) { - break; - } - } else { - /* We jump the main_locale regions */ - continue; - } - } - - menu_item = gtk_menu_item_new_with_label (name_utf8); - g_object_set_data_full (G_OBJECT (menu_item), "itemId", - g_strdup (locale), - (GDestroyNotify) g_free); - - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), - GTK_WIDGET (menu_item), position); - submenu = gtk_menu_new (); - g_signal_connect (submenu, "selection-done", - G_CALLBACK (submenu_selected_cb), dialog); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), submenu); - has_childs = FALSE; - } else { - status = U_ZERO_ERROR; - has_childs = TRUE; - - uloc_getDisplayCountry (locale, (gchar *)langs->data, - name, ICU_STRING_LONG, &status); - name_utf8 = g_utf16_to_utf8 (name, -1, - NULL, NULL, NULL); - - if (!strcmp (locale, selected_region) && menu != submenu) { - /* This is the selected region, we must - * add it also to the root menu - */ - gunichar2 language[ICU_STRING_LONG]; - gchar *language_utf8; - gchar *label; - - uloc_getDisplayLanguage (selected_region, - (gchar *)langs->data, - language, ICU_STRING_LONG, - &status); - language_utf8 = g_utf16_to_utf8 (language, - -1, NULL, NULL, NULL); - - label = g_strdup_printf ("%s (%s)", - name_utf8, - language_utf8); - - g_free (language_utf8); - - menu_item = gtk_menu_item_new_with_label (label); - selected_region_mitem = menu_item; - g_free (label); - g_object_set_data_full (G_OBJECT (menu_item), - "itemId", - g_strdup (selected_region), - (GDestroyNotify) g_free); - - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), - GTK_WIDGET (menu_item), 0); - - menu_item = gtk_separator_menu_item_new (); - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), - GTK_WIDGET (menu_item), 1); - - selected_region_added = TRUE; - } - - if (!(show_all || menu == submenu)) { - continue; - } - - if (menu == submenu && selected_region_added) { - position = 2; - } else { - position = 0; - } - - pitem_node = g_list_nth (GTK_MENU_SHELL (submenu)->children, - position); - - for ( ; pitem_node != NULL; - position++, - pitem_node = pitem_node->next) { - GtkWidget *label; - const gchar *plocale; - const gchar *txt; - - menu_item = GTK_WIDGET (pitem_node->data); - plocale = g_object_get_data - (G_OBJECT (menu_item), "itemId"); - - status = U_ZERO_ERROR; - if (!uloc_getCountry (plocale, NULL, 0, &status)) { - /* Here starts the other regions != main_language */ - break; - } - label = GTK_BIN (menu_item)->child; - txt = gtk_label_get_text (GTK_LABEL (label)); - /* FIXME: We must call setlocale */ - if (g_utf8_collate (txt, name_utf8) > 0) { - break; - } - } - - menu_item = gtk_menu_item_new_with_label (name_utf8); - if (menu == submenu) { - if (!strcmp (selected_region, locale)) { - selected_region_mitem = menu_item; - } - g_signal_connect (menu_item, "activate", - G_CALLBACK (menu_item_activated_cb), - dialog); - } - g_object_set_data_full (G_OBJECT (menu_item), "itemId", - g_strdup (locale), - (GDestroyNotify) g_free); - gtk_menu_shell_insert (GTK_MENU_SHELL (submenu), - GTK_WIDGET (menu_item), position); - } - } - - if (selected_region_mitem) { - pitem_node = GTK_MENU_SHELL (menu)->children; - position = g_list_index (pitem_node, selected_region_mitem); - if (position == -1) { - /* FIXME: We have a problem.... */ - position = 0; - } - } else { - /* FIXME: The user has a non valid region */ - position = 0; - } - - /* We remove the old menu */ - gtk_option_menu_remove_menu (GTK_OPTION_MENU (WID ("region_optionmenu"))); - /* Add the new menu */ - gtk_option_menu_set_menu (GTK_OPTION_MENU (WID ("region_optionmenu")), - GTK_WIDGET (menu)); - gtk_option_menu_set_history (GTK_OPTION_MENU - (WID ("region_optionmenu")), position); - gtk_widget_show_all (menu); - - update_region_examples (dialog, selected_region); - g_free (selected_region); -} - -static void -show_all_regions_cb (GConfClient *client, guint cnxn_id, - GConfEntry *entry, GladeXML *dialog) -{ - /* We just refresh the region_optionmenu */ - fill_region_option_menu (dialog); -} - -static void -region_changed_cb (GConfClient *client, guint cnxn_id, - GConfEntry *entry, GladeXML *dialog) -{ - GSList *langs; - gchar *selected_region; - - langs = get_selected_languages_list (); - selected_region = g_strdup (gconf_value_get_string (entry->value)); - - update_info_box (dialog, langs->data, selected_region); - - g_free (selected_region); - - /* Updates the optionmenu */ - fill_region_option_menu (dialog); - -} - -static void -dialog_response (GtkWidget *widget, - gint response_id, - GConfChangeSet *changeset) -{ - if (response_id == GTK_RESPONSE_HELP) { - /* FIXME: What should we add here? */ -/* capplet_help (GTK_WINDOW (widget), - "user-guide.xml", - "goscustperiph-2");*/ - } else { - gtk_main_quit (); - } -} - -static void -setup_dialog (GladeXML *dialog, - GConfChangeSet *changeset) -{ - GObject *peditor; - GnomeProgram *program; - GSList *langs; - const gchar *region; - - /* load all the images */ - program = gnome_program_get (); - - capplet_init_stock_icons (); - - /* Language Tab */ - - /* Flag to ignore our own updates when sorting the language list */ - our_update = FALSE; - - prepare_selected_languages_tree (dialog); - prepare_available_languages_tree (dialog); - - fill_selected_languages_tree (dialog); - fill_available_languages_tree (dialog); - - gconf_client_notify_add (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/languages", - (GConfClientNotifyFunc) languages_changed_cb, - dialog, NULL, NULL); - - g_signal_connect (G_OBJECT (WID ("languages_treeview")), "drag_end", - G_CALLBACK (languages_sorted_cb), dialog); - g_signal_connect (G_OBJECT (WID ("change_languages_button")), "clicked", - G_CALLBACK (change_languages_cb), dialog); - g_signal_connect (G_OBJECT (WID ("language_up_button")), "clicked", - G_CALLBACK (language_up_cb), dialog); - g_signal_connect (G_OBJECT (WID ("language_down_button")), "clicked", - G_CALLBACK (language_down_cb), dialog); - - /* Formats Tab */ - fill_region_option_menu (dialog); - - peditor = gconf_peditor_new_boolean - (changeset, GCONF_LOCALIZATION_ROOT_KEY "/show_all_regions", - WID ("show_all_checkbutton"), NULL); - - gconf_client_notify_add (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/show_all_regions", - (GConfClientNotifyFunc) show_all_regions_cb, - dialog, NULL, NULL); - - gconf_client_notify_add (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", - (GConfClientNotifyFunc) region_changed_cb, - dialog, NULL, NULL); - - langs = get_selected_languages_list(); - region = gconf_client_get_string (gconf_client_get_default (), - GCONF_LOCALIZATION_ROOT_KEY "/region", NULL); - - update_info_box (dialog, langs->data, region); - g_free (region); - - /* Dialog action buttons */ - g_signal_connect (G_OBJECT (WID ("localization_dialog")), "response", - G_CALLBACK (dialog_response), changeset); - -} - -int -main (int argc, char **argv) -{ - GConfClient *client; - GConfChangeSet *changeset; - GladeXML *dialog; - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - gnome_program_init ("gnome-localization-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, - GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, - NULL); - - activate_settings_daemon (); - - client = gconf_client_get_default (); - gconf_client_add_dir (client, GCONF_LOCALIZATION_ROOT_KEY, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - - changeset = NULL; - dialog = create_dialog (); - setup_dialog (dialog, changeset); - capplet_set_icon (WID ("localization_dialog"), "localization-capplet"); - gtk_widget_show (WID ("localization_dialog")); - gtk_main (); - - return 0; -} diff --git a/capplets/localization/gnome-localization-properties.glade b/capplets/localization/gnome-localization-properties.glade deleted file mode 100644 index a3242722d..000000000 --- a/capplets/localization/gnome-localization-properties.glade +++ /dev/null @@ -1,1024 +0,0 @@ - - - - - - - - 6 - Language and Culture Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - -11 - - - - - - True - True - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - True - True - True - GTK_POS_TOP - False - False - - - - 12 - True - False - 6 - - - - True - <b>Languages in use:</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - False - 6 - - - - 250 - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - False - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_SPREAD - 0 - - - - True - True - True - gtk-go-up - True - GTK_RELIEF_NORMAL - - - - - - True - True - True - gtk-go-down - True - GTK_RELIEF_NORMAL - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - False - 12 - - - - True - Drag languages to set the preferred -order of use; If there exists a -translation in the first language it will -be used, otherwise the next will be tried - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - True - C_hange languages in use... - True - GTK_RELIEF_NORMAL - - - 0 - False - False - - - - - 0 - False - False - - - - - - False - 6 - - - - True - gtk-dialog-warning - 4 - 0 - 0 - 0 - 0 - - - 0 - False - False - - - - - - True - Changes will not take effect for the -desktop's bars and menus before -next time you log in. Changes take -effect in applications next time you -run them. - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - False - False - - - - - - False - 6 - - - - True - gtk-dialog-info - 4 - 0 - 0 - 0 - 0 - - - 0 - False - False - - - - - - True - Your preferred language differs -from that of your currently -selected date, time, and number -formats. You can change your -formats in the Formats tab. - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - False - True - - - - - - True - Language - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 12 - True - False - 12 - - - - True - False - 12 - - - - True - _Region: - True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - region_optionmenu - - - 0 - True - True - - - - - - 6 - True - True - -1 - - - 0 - True - True - - - - - - True - True - Show _all regions - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - False - 12 - - - - True - <b>Dates</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - False - 6 - - - - True - Thursday, January 2, 2003 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - False - False - - - - - - True - Jan 2, 2003 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - False - False - - - - - - True - 1/2/03 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - Customize _dates... - True - GTK_RELIEF_NORMAL - - - 0 - True - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - False - 12 - - - - True - <b>Times</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - False - 0 - - - - True - 12:34 AM - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - False - False - - - - - - True - 4:56 PM - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - Customize _times... - True - GTK_RELIEF_NORMAL - - - 0 - True - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - False - 12 - - - - True - <b>Numbers</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - $1,234.56 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - - - 0 - True - True - - - - - - True - Customize _numbers... - True - GTK_RELIEF_NORMAL - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - False - 12 - - - - True - Measurement _Units: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 12 - 0 - measure_optionmenu - - - 0 - False - False - - - - - - True - True - -1 - - - 0 - False - False - - - - - 0 - False - False - - - - - False - True - - - - - - True - Formats - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - 0 - True - True - - - - - - - - 6 - Available Languages - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - Select the items that appear in the Languages list: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - 250 - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - diff --git a/capplets/localization/localization-capplet.png b/capplets/localization/localization-capplet.png deleted file mode 100644 index 35ebd6e50..000000000 Binary files a/capplets/localization/localization-capplet.png and /dev/null differ diff --git a/capplets/localization/localization.desktop.in.in b/capplets/localization/localization.desktop.in.in deleted file mode 100644 index 43303bced..000000000 --- a/capplets/localization/localization.desktop.in.in +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -_Name=Language and Culture -_Comment=Set your language and culture preferences -Exec=gnome-localization-properties -Icon=localization-capplet -Terminal=false -Type=Application -StartupNotify=true -Categories=GNOME;GTK;Application;Settings;DesktopSettings; -OnlyShowIn=GNOME; -X-GNOME-Bugzilla-Bugzilla=GNOME -X-GNOME-Bugzilla-Product=control-center -X-GNOME-Bugzilla-Version=@VERSION@ diff --git a/capplets/mime-type/ChangeLog b/capplets/mime-type/ChangeLog deleted file mode 100644 index 18b71483d..000000000 --- a/capplets/mime-type/ChangeLog +++ /dev/null @@ -1,112 +0,0 @@ -2004-10-14 Jody Goldberg - - * Release 2.8.1 - -2004-04-15 Jody Goldberg - - * Release 2.6.1 - -2004-04-01 Jody Goldberg - - * Release 2.6.0.3 - -2004-03-30 Jody Goldberg - - * Release 2.6.0.1 - -2004-03-23 Jody Goldberg - - * Release 2.6.0 - -2004-03-11 Jody Goldberg - - * Release 2.5.4 - -2004-02-13 Jody Goldberg - - * Release 2.5.3 - -2004-01-14 Jody Goldberg - - * Release 2.5.2 - -2003-12-30 Jody Goldberg - - * Release 2.5.1.1 - -2003-12-30 Jody Goldberg - - * Release 2.5.1 - -2003-10-28 Jody Goldberg - - * Release 2.5.0 - -2003-07-07 Jody Goldberg - - * Release 2.3.4 - -2003-06-24 Jody Goldberg - - * Release 2.3.3 - -2003-05-07 Jody Goldberg - - * Release 2.3.1 - -Tue Feb 4 17:09:18 2003 Jonathan Blandford - - * Release 2.2.0.1 - -Tue Jan 21 01:15:14 2003 Jonathan Blandford - - * Release 2.2.0 - -Thu Jan 16 02:41:09 2003 Jonathan Blandford - - * Release 2.1.7 - -2003-01-10 Jody Goldberg - - * Release 2.1.6 - -2002-12-18 Jody Goldberg - - * Release 2.1.5 - -2002-11-23 Jody Goldberg - - * Release 2.1.3 - -2002-11-02 Jody Goldberg - - * Release 2.1.2 - -2002-10-21 Jody Goldberg - - * Release 2.1.1 - -2002-10-01 Jody Goldberg - - * Release 2.1.0.1 - -2002-08-21 Jody Goldberg - - * Release 2.1.0 - -2002-06-17 Jody Goldberg - - * Release 2.0.0 - -2001-07-27 Bradford Hovinen - - * RELEASE : 1.5.2 - -2001-07-24 Richard Hestilow - - * mime-data.c (get_mime_clist): Set clist to reasonable default size. - -2001-07-20 Chema Celorio - - * RELEASE : 1.5.0 - diff --git a/capplets/mime-type/Makefile.am b/capplets/mime-type/Makefile.am deleted file mode 100644 index 6452f1e01..000000000 --- a/capplets/mime-type/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -cappletname = mime-type -cappletgroup = "Advanced/" -bin_PROGRAMS = mime-type-capplet - -mime_type_capplet_LDADD = $(GNOMECC_CAPPLETS_LIBS) -mime_type_capplet_SOURCES = \ - mime-type-capplet.c\ - mime-data.h mime-data.c\ - edit-window.c edit-window.h\ - mime-info.c mime-info.h\ - new-mime-window.h new-mime-window.c - -pixmap_DATA = - -## -## You should not need to modify anything below this line -## -@INTLTOOL_DESKTOP_RULE@ -@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@ - -INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) -CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) -EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) -iconsdir = $(pkgdatadir)/icons -Gladedir = $(pkgdatadir)/glade -pixmapdir = $(pkgdatadir)/pixmaps -Glade_DATA = $(cappletname)-properties.glade -icons_DATA = $(cappletname)-capplet.png -desktop = $(cappletname).desktop -all-local: $(desktop) diff --git a/capplets/mime-type/edit-window.c b/capplets/mime-type/edit-window.c deleted file mode 100644 index 98dd8bb51..000000000 --- a/capplets/mime-type/edit-window.c +++ /dev/null @@ -1,578 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "edit-window.h" -#include "mime-data.h" -#include "mime-info.h" -#include "capplet-widget.h" - - -extern GtkWidget *capplet; -extern GHashTable *user_mime_types; - -typedef struct { - GtkWidget *window; - GtkWidget *icon_entry; - GtkWidget *mime_type; -/* GtkWidget *ext_tag_label; */ - GtkWidget *regexp1_tag_label; - GtkWidget *regexp2_tag_label; -/* GtkWidget *ext_label; */ - GtkWidget *regexp1_label; - GtkWidget *regexp2_label; - GtkWidget *open_entry; - GtkWidget *edit_entry; - GtkWidget *view_entry; - GtkWidget *ext_scroll; - GtkWidget *ext_clist; - GtkWidget *ext_entry; - GtkWidget *ext_add_button; - GtkWidget *ext_remove_button; - MimeInfo *mi; - MimeInfo *user_mi; - GList *tmp_ext[2]; -} edit_window; -static edit_window *main_win = NULL; -static gboolean changing = TRUE; -static void -destruction_handler (GtkWidget *widget, gpointer data) -{ - g_free (main_win); - main_win = NULL; -} -static void -entry_changed (GtkWidget *widget, gpointer data) -{ - if (changing == FALSE) - capplet_widget_state_changed (CAPPLET_WIDGET (capplet), - TRUE); -} -static void -ext_clist_selected (GtkWidget *clist, gint row, gint column, gpointer data) -{ - gboolean deletable; - - deletable = GPOINTER_TO_INT (gtk_clist_get_row_data (GTK_CLIST (clist), row)); - if (deletable) - gtk_widget_set_sensitive (main_win->ext_remove_button, TRUE); - else - gtk_widget_set_sensitive (main_win->ext_remove_button, FALSE); -} -static void -ext_clist_deselected (GtkWidget *clist, gint row, gint column, gpointer data) -{ - if (g_list_length (GTK_CLIST (clist)->selection) == 0) - gtk_widget_set_sensitive (main_win->ext_remove_button, FALSE); -} -static void -ext_entry_changed (GtkWidget *entry, gpointer data) -{ - gchar *text; - text = gtk_entry_get_text (GTK_ENTRY (entry)); - gtk_widget_set_sensitive (main_win->ext_add_button, (strlen (text) >0)); -} -static void -ext_add (GtkWidget *widget, gpointer data) -{ - gchar *row[1]; - gint rownumber; - - row[0] = g_strdup (gtk_entry_get_text (GTK_ENTRY (main_win->ext_entry))); - rownumber = gtk_clist_append (GTK_CLIST (main_win->ext_clist), row); - gtk_clist_set_row_data (GTK_CLIST (main_win->ext_clist), rownumber, - GINT_TO_POINTER (TRUE)); - gtk_entry_set_text (GTK_ENTRY (main_win->ext_entry), ""); - - main_win->tmp_ext[0] = g_list_prepend (main_win->tmp_ext[0], row[0]); - if (changing == FALSE) - capplet_widget_state_changed (CAPPLET_WIDGET (capplet), - TRUE); -} -static void -ext_remove (GtkWidget *widget, gpointer data) -{ - gint row; - gchar *text; - gchar *store; - GList *tmp; - - text = (gchar *)g_malloc (sizeof (gchar) * 1024); - gtk_clist_freeze (GTK_CLIST (main_win->ext_clist)); - row = GPOINTER_TO_INT (GTK_CLIST (main_win->ext_clist)->selection->data); - gtk_clist_get_text (GTK_CLIST (main_win->ext_clist), row, 0, &text); - store = g_strdup (text); - gtk_clist_remove (GTK_CLIST (main_win->ext_clist), row); - - gtk_clist_thaw (GTK_CLIST (main_win->ext_clist)); - - for (tmp = main_win->tmp_ext[0]; tmp; tmp = tmp->next) { - GList *found; - - if (strcmp (tmp->data, store) == 0) { - found = tmp; - - main_win->tmp_ext[0] = g_list_remove_link (main_win->tmp_ext[0], found); - g_list_free_1 (found); - break; - } - } - - if (changing == FALSE) - capplet_widget_state_changed (CAPPLET_WIDGET (capplet), - TRUE); -} -static void -apply_entry_change (GtkWidget *entry, gchar *key, MimeInfo *mi) -{ - const gchar *buf; - gchar *text; - /* buf is the value that existed before when we - * started the capplet */ - buf = local_mime_get_value (mi->mime_type, key); - if (buf == NULL) - buf = gnome_mime_get_value (mi->mime_type, key); - text = gtk_entry_get_text (GTK_ENTRY (entry)); - if (text && !*text) - text = NULL; - - /* First we see if they've added something. */ - if (buf == NULL && text) - set_mime_key_value (mi->mime_type, key, text); - else { - /* Has the value changed? */ - if (text && strcmp (text, buf)) - set_mime_key_value (mi->mime_type, key, text); - else - /* We _REALLY_ need a way to specify in - * user.keys not to use the system defaults. - * (ie. override the system default and - * query it). - * If we could then we'd set it here. */ - ; - } -} -static GList* -copy_mi_extensions (GList *orig) -{ - GList *tmp; - GList *list = NULL; - - for (tmp = orig; tmp; tmp = tmp->next) { - list = g_list_append (list, g_strdup (tmp->data)); - } - return list; -} -static void -make_readable (MimeInfo *mi) -{ - GList *list; - GString *extension; - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->user_ext[0]; list; list = list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - mi->ext_readable[0] = extension->str; - g_string_free (extension, FALSE); - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->user_ext[1]; list; list = list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - mi->ext_readable[1] = extension->str; - g_string_free (extension, FALSE); -} -static void -apply_changes (MimeInfo *mi) -{ - GList *tmp; - int i; - - apply_entry_change (gnome_icon_entry_gtk_entry (GNOME_ICON_ENTRY (main_win->icon_entry)), - "icon-filename", mi); - apply_entry_change (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->open_entry)), - "open", mi); - apply_entry_change (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->view_entry)), - "view", mi); - apply_entry_change (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->edit_entry)), - "edit", mi); - - if (!main_win->user_mi) { - add_to_key (mi->mime_type, "ext: tmp", user_mime_types, TRUE); - /* the tmp extension will be removed when we copy the tmp_ext - * stuff over the top of it. - */ - main_win->user_mi = g_hash_table_lookup (user_mime_types, - mi->mime_type); - } - - for (i = 0; i < 2; i++) { - if (main_win->tmp_ext[i]) { - main_win->user_mi->user_ext[i] = copy_mi_extensions (main_win->tmp_ext[i]); - mi->user_ext[i] = copy_mi_extensions (main_win->tmp_ext[i]); - } else { - main_win->user_mi->user_ext[i] = NULL; - mi->user_ext[i] = NULL; - } - } - - make_readable (main_win->user_mi); - - if (! (main_win->user_mi->ext[0] || main_win->user_mi->ext[1] || - main_win->user_mi->user_ext[0] || main_win->user_mi->ext[1])) - g_hash_table_remove (user_mime_types, mi->mime_type); - - /* Free the 2 tmp lists */ - for (i = 0; i < 2; i++) { - if (main_win->tmp_ext[i]) - for (tmp = main_win->tmp_ext[i]; tmp; tmp = tmp->next) - g_free (tmp->data); - } - if (changing == FALSE) - capplet_widget_state_changed (CAPPLET_WIDGET (capplet), - TRUE); -} -static void -browse_callback (GtkWidget *widget, gpointer data) -{ -} -static void -initialize_main_win () -{ - GtkWidget *align, *vbox, *hbox, *vbox2, *vbox3; - GtkWidget *frame, *table, *label; - GtkWidget *button; - GString *extension; - gchar *title[2] = {"Extensions"}; - - main_win = g_new (edit_window, 1); - main_win->window = gnome_dialog_new ("", - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - gtk_signal_connect (GTK_OBJECT (main_win->window), - "destroy", - destruction_handler, - NULL); - vbox = GNOME_DIALOG (main_win->window)->vbox; - - /* icon box */ - main_win->icon_entry = gnome_icon_entry_new ("mime_icon_entry", _("Select an icon...")); - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (align), main_win->icon_entry); - gtk_signal_connect (GTK_OBJECT (gnome_icon_entry_gtk_entry (GNOME_ICON_ENTRY (main_win->icon_entry))), - "changed", - entry_changed, - NULL); - gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); - - hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); - gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("Mime Type: ")), FALSE, FALSE, 0); - main_win->mime_type = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), main_win->mime_type, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - - /* extension/regexp */ - vbox2 = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0); - - hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); - main_win->ext_clist = gtk_clist_new_with_titles (1, title); - gtk_clist_column_titles_passive (GTK_CLIST (main_win->ext_clist)); - gtk_clist_set_auto_sort (GTK_CLIST (main_win->ext_clist), TRUE); - - gtk_signal_connect (GTK_OBJECT (main_win->ext_clist), - "select-row", - GTK_SIGNAL_FUNC (ext_clist_selected), - NULL); - gtk_signal_connect (GTK_OBJECT (main_win->ext_clist), - "unselect-row", - GTK_SIGNAL_FUNC (ext_clist_deselected), - NULL); - main_win->ext_scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (main_win->ext_scroll), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (main_win->ext_scroll), - main_win->ext_clist); - - vbox3 = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - main_win->ext_add_button = gtk_button_new_with_label (_("Add")); - gtk_signal_connect (GTK_OBJECT (main_win->ext_add_button), - "clicked", - GTK_SIGNAL_FUNC (ext_add), - NULL); - gtk_box_pack_start (GTK_BOX (vbox3), main_win->ext_add_button, FALSE, FALSE, 0); - gtk_widget_set_sensitive (main_win->ext_add_button, FALSE); - - main_win->ext_remove_button = gtk_button_new_with_label (_("Remove")); - gtk_signal_connect (GTK_OBJECT (main_win->ext_remove_button), - "clicked", - GTK_SIGNAL_FUNC (ext_remove), - NULL); - gtk_widget_set_sensitive (main_win->ext_remove_button, FALSE); - gtk_box_pack_start (GTK_BOX (vbox3), main_win->ext_remove_button, - FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (hbox), main_win->ext_scroll, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), vbox3, FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0); - - main_win->ext_entry = gtk_entry_new (); - gtk_signal_connect (GTK_OBJECT (main_win->ext_entry), - "changed", - ext_entry_changed, - NULL); - gtk_signal_connect (GTK_OBJECT (main_win->ext_entry), - "activate", - ext_add, - NULL); - gtk_box_pack_start (GTK_BOX (vbox2), main_win->ext_entry, TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); - main_win->regexp1_label = gtk_label_new (""); - main_win->regexp1_tag_label = gtk_label_new (_("First Regular Expression: ")); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), main_win->regexp1_tag_label, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), main_win->regexp1_label, FALSE, FALSE, 0); - - hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); - main_win->regexp2_label = gtk_label_new (""); - main_win->regexp2_tag_label = gtk_label_new (_("Second Regular Expression: ")); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), main_win->regexp2_tag_label, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), main_win->regexp2_label, FALSE, FALSE, 0); - - /* Actions box */ - frame = gtk_frame_new (_("Mime Type Actions")); - vbox2 = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); - table = gtk_table_new (3, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL); - gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (frame), vbox2); - label = gtk_label_new (_("Example: emacs %f")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 2, 0); - gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0); - label = gtk_label_new (_("Open")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 2, 0); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 0, 1); - main_win->open_entry = gnome_file_entry_new ("MIME_CAPPLET_OPEN", _("Select a file...")); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->open_entry))), - "changed", - entry_changed, - NULL); - - gtk_table_attach_defaults (GTK_TABLE (table), - main_win->open_entry, - 1, 2, 0, 1); - label = gtk_label_new (_("View")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 2, 0); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 1, 2); - - main_win->view_entry = gnome_file_entry_new ("MIME_CAPPLET_VIEW", _("Select a file...")); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->view_entry))), - "changed", - entry_changed, - NULL); - - gtk_table_attach_defaults (GTK_TABLE (table), - main_win->view_entry, - 1, 2, 1, 2); - label = gtk_label_new (_("Edit")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 2, 0); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 2, 3); - main_win->edit_entry = gnome_file_entry_new ("MIME_CAPPLET_EDIT", _("Select a file...")); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (main_win->edit_entry))), - "changed", - entry_changed, - NULL); - gtk_table_attach_defaults (GTK_TABLE (table), - main_win->edit_entry, - 1, 2, 2, 3); -} -static void -setup_entry (gchar *key, GtkWidget *g_entry, MimeInfo *mi) -{ - const gchar *buf; - GtkWidget *entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (g_entry)); - buf = local_mime_get_value (mi->mime_type, key); - if (buf == NULL) - buf = gnome_mime_get_value (mi->mime_type, key); - if (buf) - gtk_entry_set_text (GTK_ENTRY (entry), buf); - else - gtk_entry_set_text (GTK_ENTRY (entry), ""); -} -void -initialize_main_win_vals (void) -{ - MimeInfo *mi; - gchar *title; - gboolean showext = FALSE; - if (main_win == NULL) - return; - mi = main_win->mi; - if (mi == NULL) - return; - /* now we fill in the fields with the mi stuff. */ - - changing = TRUE; - gtk_label_set_text (GTK_LABEL (main_win->mime_type), mi->mime_type); - gnome_icon_entry_set_icon (GNOME_ICON_ENTRY (main_win->icon_entry), - gnome_mime_get_value (mi->mime_type, - "icon-filename")); - - gtk_widget_show_all (GNOME_DIALOG (main_win->window)->vbox); - /* we initialize everything */ - title = g_strdup_printf (_("Set actions for %s"), mi->mime_type); - gtk_window_set_title (GTK_WINDOW (main_win->window), title); - g_free (title); - - /* not sure why this is necessary */ - gtk_clist_clear (GTK_CLIST (main_win->ext_clist)); - if (mi->ext[0]) { - GList *tmp; - gchar *extension[1]; - gint row; - for (tmp = mi->ext[0]; tmp; tmp = tmp->next) { - extension[0] = g_strdup (tmp->data); - row = gtk_clist_append (GTK_CLIST (main_win->ext_clist), - extension); - gtk_clist_set_row_data (GTK_CLIST (main_win->ext_clist), - row, GINT_TO_POINTER (FALSE)); - } - showext = TRUE; - } - if (mi->ext[1]) { - GList *tmp; - gchar *extension[1]; - gint row; - for (tmp = mi->ext[1]; tmp; tmp = tmp->next) { - extension[0] = g_strdup (tmp->data); - row = gtk_clist_append (GTK_CLIST (main_win->ext_clist), - extension); - gtk_clist_set_row_data (GTK_CLIST (main_win->ext_clist), - row, GINT_TO_POINTER (FALSE)); - } - showext = TRUE; - } - if (main_win->tmp_ext[0]) { - GList *tmp; - gchar *extension[1]; - gint row; - for (tmp = main_win->tmp_ext[0]; tmp; tmp = tmp->next) { - extension[0] = g_strdup (tmp->data); - row = gtk_clist_append (GTK_CLIST (main_win->ext_clist), - extension); - gtk_clist_set_row_data (GTK_CLIST (main_win->ext_clist), - row, GINT_TO_POINTER (TRUE)); - } - showext = TRUE; - } - if (main_win->tmp_ext[1]) { - GList *tmp; - gchar *extension[1]; - gint row; - for (tmp = main_win->tmp_ext[0]; tmp; tmp = tmp->next) { - extension[0] = g_strdup (tmp->data); - row = gtk_clist_append (GTK_CLIST (main_win->ext_clist), - extension); - gtk_clist_set_row_data (GTK_CLIST (main_win->ext_clist), - row, GINT_TO_POINTER (TRUE)); - } - showext = TRUE; - } - if (!showext) { - gtk_widget_hide (main_win->ext_clist); - gtk_widget_hide (main_win->ext_entry); - gtk_widget_hide (main_win->ext_add_button); - gtk_widget_hide (main_win->ext_remove_button); - gtk_widget_hide (main_win->ext_scroll); - } - if (mi->regex_readable[0]) - gtk_label_set_text (GTK_LABEL (main_win->regexp1_label), - mi->regex_readable[0]); - else { - gtk_widget_hide (main_win->regexp1_label); - gtk_widget_hide (main_win->regexp1_tag_label); - } - if (mi->regex_readable[1]) - gtk_label_set_text (GTK_LABEL (main_win->regexp2_label), - mi->regex_readable[1]); - else { - gtk_widget_hide (main_win->regexp2_label); - gtk_widget_hide (main_win->regexp2_tag_label); - } - /* initialize the entries */ - setup_entry ("open", main_win->open_entry, mi); - setup_entry ("view", main_win->view_entry, mi); - setup_entry ("edit", main_win->edit_entry, mi); - changing = FALSE; - -} -void -launch_edit_window (MimeInfo *mi) -{ - gint size; - - if (main_win == NULL) - initialize_main_win (); - main_win->mi = mi; - main_win->user_mi = g_hash_table_lookup (user_mime_types, mi->mime_type); - main_win->tmp_ext[0] = NULL; - main_win->tmp_ext[1] = NULL; - if (main_win->user_mi) { - if (main_win->user_mi->user_ext[0]) - main_win->tmp_ext[0] = copy_mi_extensions (main_win->user_mi->user_ext[0]); - if (main_win->user_mi->user_ext[1]) - main_win->tmp_ext[1] = copy_mi_extensions (main_win->user_mi->user_ext[1]); - } - initialize_main_win_vals (); - - switch(gnome_dialog_run (GNOME_DIALOG (main_win->window))) { - case 0: - apply_changes (mi); - case 1: - main_win->mi = NULL; - gtk_widget_hide (main_win->window); - break; - } -} - -void -hide_edit_window (void) -{ - if (main_win && main_win->mi && main_win->window) - gtk_widget_hide (main_win->window); -} -void -show_edit_window (void) -{ - if (main_win && main_win->mi && main_win->window) - gtk_widget_show (main_win->window); -} - - - - diff --git a/capplets/mime-type/edit-window.h b/capplets/mime-type/edit-window.h deleted file mode 100644 index 626a7c6be..000000000 --- a/capplets/mime-type/edit-window.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ -#include "mime-data.h" -#ifndef _EDIT_WINDOW_H_ -#define _EDIT_WINDOW_H_ - - -void launch_edit_window (MimeInfo *mi); -void initialize_main_win_vals (void); -void hide_edit_window (void); -void show_edit_window (void); - -#endif diff --git a/capplets/mime-type/mime-data.c b/capplets/mime-type/mime-data.c deleted file mode 100644 index a4698edae..000000000 --- a/capplets/mime-type/mime-data.c +++ /dev/null @@ -1,661 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "capplet-widget.h" -#include "gnome.h" -#include -#include -#include -#include -#include -#include "edit-window.h" -#include "mime-data.h" -#include "mime-info.h" -#include "new-mime-window.h" -#include -#include -#include - - -/* Prototypes */ -static void mime_fill_from_file (const char *filename, gboolean init_user); -static void mime_load_from_dir (const char *mime_info_dir, gboolean system_dir); -void add_to_key (char *mime_type, char *def, GHashTable *table, gboolean init_user); -static char *get_priority (char *def, int *priority); - - -/* Global variables */ -static char *current_lang; -static GHashTable *mime_types = NULL; -static GHashTable *initial_user_mime_types = NULL; -GHashTable *user_mime_types = NULL; -static GtkWidget *clist = NULL; -extern GtkWidget *delete_button; -extern GtkWidget *capplet; -/* Initialization functions */ -static void -run_error (gchar *message) -{ - GtkWidget *error_box; - - error_box = gnome_message_box_new ( - message, - GNOME_MESSAGE_BOX_ERROR, - GNOME_STOCK_BUTTON_OK, - NULL); - gnome_dialog_run_and_close (GNOME_DIALOG (error_box)); -} -static char * -get_priority (char *def, int *priority) -{ - *priority = 0; - - if (*def == ','){ - def++; - if (*def == '1'){ - *priority = 0; - def++; - } else if (*def == '2'){ - *priority = 1; - def++; - } - } - - while (*def && *def == ':') - def++; - - return def; -} -static void -free_mime_info (MimeInfo *mi) -{ - -} -void -add_to_key (char *mime_type, char *def, GHashTable *table, gboolean init_user) -{ - int priority = 1; - char *s, *p, *ext; - int used; - MimeInfo *info; - - info = g_hash_table_lookup (table, (const void *) mime_type); - if (info == NULL) { - info = g_malloc (sizeof (MimeInfo)); - info->mime_type = g_strdup (mime_type); - info->regex[0] = NULL; - info->regex[1] = NULL; - info->ext[0] = NULL; - info->ext[1] = NULL; - info->user_ext[0] = NULL; - info->user_ext[1] = NULL; - info->regex_readable[0] = NULL; - info->regex_readable[1] = NULL; - info->ext_readable[0] = NULL; - info->ext_readable[1] = NULL; - info->keys = gnome_mime_get_keys (mime_type); - g_hash_table_insert (table, info->mime_type, info); - } - if (strncmp (def, "ext", 3) == 0){ - char *tokp; - - def += 3; - def = get_priority (def, &priority); - s = p = g_strdup (def); - - used = 0; - - while ((ext = strtok_r (s, " \t\n\r,", &tokp)) != NULL){ - /* FIXME: We really need to check for duplicates before entering this. */ - if (!init_user) { - info->ext[priority] = g_list_prepend (info->ext[priority], ext); - } else { - info->user_ext[priority] = g_list_prepend (info->user_ext[priority], ext); - } - used = 1; - s = NULL; - } - if (!used) - g_free (p); - } - - if (strncmp (def, "regex", 5) == 0){ - regex_t *regex; - - regex = g_new (regex_t, 1); - def += 5; - def = get_priority (def, &priority); - - while (*def && isspace (*def)) - def++; - - if (!*def) - return; - if (regcomp (regex, def, REG_EXTENDED | REG_NOSUB)) - g_free (regex); - else { - info->regex[priority] = regex; - g_free (info->regex_readable[priority]); - info->regex_readable[priority] = g_strdup (def); - } - } -} -static void -mime_fill_from_file (const char *filename, gboolean init_user) -{ - FILE *f; - char buf [1024]; - char *current_key; - gboolean used; - - g_assert (filename != NULL); - - f = fopen (filename, "r"); - if (!f) - return; - - current_key = NULL; - used = FALSE; - while (fgets (buf, sizeof (buf), f)){ - char *p; - - if (buf [0] == '#') - continue; - - /* Trim trailing spaces */ - for (p = buf + strlen (buf) - 1; p >= buf; p--){ - if (isspace (*p) || *p == '\n') - *p = 0; - else - break; - } - - if (!buf [0]) - continue; - - if (buf [0] == '\t' || buf [0] == ' '){ - if (current_key){ - char *p = buf; - - while (*p && isspace (*p)) - p++; - - if (*p == 0) - continue; - add_to_key (current_key, p, mime_types, init_user); - if (init_user) { - add_to_key (current_key, p, - initial_user_mime_types, - TRUE); - add_to_key (current_key, p, - user_mime_types, TRUE); - } - used = TRUE; - } - } else { - if (!used && current_key) - g_free (current_key); - current_key = g_strdup (buf); - if (current_key [strlen (current_key)-1] == ':') - current_key [strlen (current_key)-1] = 0; - - used = FALSE; - } - } - fclose (f); -} - -static void -mime_load_from_dir (const char *mime_info_dir, gboolean system_dir) -{ - DIR *dir; - struct dirent *dent; - const int extlen = sizeof (".mime") - 1; - char *filename; - - dir = opendir (mime_info_dir); - if (!dir) - return; - if (system_dir) { - filename = g_build_filename (mime_info_dir, "gnome.mime", NULL); - mime_fill_from_file (filename, FALSE); - g_free (filename); - } - while ((dent = readdir (dir)) != NULL){ - - int len = strlen (dent->d_name); - - if (len <= extlen) - continue; - - if (strcmp (dent->d_name + len - extlen, ".mime")) - continue; - if (system_dir && !strcmp (dent->d_name, "gnome.mime")) - continue; - if (!system_dir && !strcmp (dent->d_name, "user.mime")) - continue; - - filename = g_build_filename (mime_info_dir, dent->d_name, NULL); - mime_fill_from_file (filename, FALSE); - g_free (filename); - } - if (!system_dir) { - filename = g_build_filename (mime_info_dir, "user.mime", NULL); - mime_fill_from_file (filename, TRUE); - g_free (filename); - } - closedir (dir); -} -static int -add_mime_vals_to_clist (gchar *mime_type, gpointer mi, gpointer cl) -{ - /* we also finalize the MimeInfo structure here, now that we're done - * loading it */ - static gchar *text[2]; - GList *list; - GString *extension; - gint row; - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->ext[0];list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - if (strcmp (extension->str, "") != 0 && ((MimeInfo *)mi)->user_ext[0]) - g_string_append (extension, ", "); - for (list = ((MimeInfo *) mi)->user_ext[0]; list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - ((MimeInfo *) mi)->ext_readable[0] = extension->str; - g_string_free (extension, FALSE); - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->ext[1];list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next) - g_string_append (extension, ", "); - } - if (strcmp (extension->str, "") != 0 && ((MimeInfo *)mi)->user_ext[1]) - g_string_append (extension, ", "); - for (list = ((MimeInfo *) mi)->user_ext[1]; list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - ((MimeInfo *) mi)->ext_readable[1] = extension->str; - g_string_free (extension, FALSE); - - if (((MimeInfo *) mi)->ext[0] || ((MimeInfo *) mi)->user_ext[0]) { - extension = g_string_new ((((MimeInfo *) mi)->ext_readable[0])); - if (((MimeInfo *) mi)->ext[1] || ((MimeInfo *) mi)->user_ext[1]) { - g_string_append (extension, ", "); - g_string_append (extension, (((MimeInfo *) mi)->ext_readable[1])); - } - } else if (((MimeInfo *) mi)->ext[1] || ((MimeInfo *) mi)->user_ext[1]) - extension = g_string_new ((((MimeInfo *) mi)->ext_readable[1])); - else - extension = g_string_new (""); - - text[0] = ((MimeInfo *) mi)->mime_type; - text[1] = extension->str; - - row = gtk_clist_insert (GTK_CLIST (cl), 1, text); - gtk_clist_set_row_data (GTK_CLIST (cl), row, mi); - g_string_free (extension, TRUE); - return row; -} -static void -selected_row_callback (GtkWidget *widget, gint row, gint column, GdkEvent *event, gpointer data) -{ - MimeInfo *mi; - if (column < 0) - return; - - mi = (MimeInfo *) gtk_clist_get_row_data (GTK_CLIST (widget),row); - - if (event && event->type == GDK_2BUTTON_PRESS) - launch_edit_window (mi); - - if (g_hash_table_lookup (user_mime_types, mi->mime_type)) { - gtk_widget_set_sensitive (delete_button, TRUE); - } else - gtk_widget_set_sensitive (delete_button, FALSE); -} - -/* public functions */ -void -delete_clicked (GtkWidget *widget, gpointer data) -{ - MimeInfo *mi; - gint row = 0; - - if (GTK_CLIST (clist)->selection) - row = GPOINTER_TO_INT ((GTK_CLIST (clist)->selection)->data); - else - return; - mi = (MimeInfo *) gtk_clist_get_row_data (GTK_CLIST (clist), row); - - gtk_clist_remove (GTK_CLIST (clist), row); - g_hash_table_remove (user_mime_types, mi->mime_type); - remove_mime_info (mi->mime_type); - free_mime_info (mi); - capplet_widget_state_changed (CAPPLET_WIDGET (capplet), - TRUE); -} - -void -edit_clicked (GtkWidget *widget, gpointer data) -{ - MimeInfo *mi; - gint row = 0; - - if (GTK_CLIST (clist)->selection) - row = GPOINTER_TO_INT ((GTK_CLIST (clist)->selection)->data); - else - return; - mi = (MimeInfo *) gtk_clist_get_row_data (GTK_CLIST (clist), row); - if (mi) - launch_edit_window (mi); - gtk_clist_remove (GTK_CLIST (clist), row); - row = add_mime_vals_to_clist (mi->mime_type, mi, clist); - gtk_clist_select_row (GTK_CLIST (clist), row, 0); -} -void -add_clicked (GtkWidget *widget, gpointer data) -{ - launch_new_mime_window (); -} - -GtkWidget * -get_mime_clist (void) -{ - GtkWidget *retval; - gchar *titles[2]; - - titles[0] = _("Mime Type"); - titles[1] = _("Extension"); - retval = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (retval), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - clist = gtk_clist_new_with_titles (2, titles); - gtk_widget_set_usize (clist, 400, 300); - gtk_signal_connect (GTK_OBJECT (clist), - "select_row", - GTK_SIGNAL_FUNC (selected_row_callback), - NULL); - gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE); - gtk_clist_set_auto_sort (GTK_CLIST (clist), TRUE); - if (clist) - g_hash_table_foreach (mime_types, (GHFunc) add_mime_vals_to_clist, clist); - gtk_clist_columns_autosize (GTK_CLIST (clist)); - gtk_clist_select_row (GTK_CLIST (clist), 0, 0); - gtk_container_add (GTK_CONTAINER (retval), clist); - return retval; -} - -static void -finalize_mime_type_foreach (gpointer mime_type, gpointer info, gpointer data) -{ - MimeInfo *mi = (MimeInfo *)info; - GList *list; - GString *extension; - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->ext[0];list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - if (strcmp (extension->str, "") != 0 && mi->user_ext[0]) - g_string_append (extension, ", "); - for (list = ((MimeInfo *) mi)->user_ext[0]; list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - ((MimeInfo *) mi)->ext_readable[0] = extension->str; - g_string_free (extension, FALSE); - - extension = g_string_new (""); - for (list = ((MimeInfo *) mi)->ext[1];list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next) - g_string_append (extension, ", "); - } - if (strcmp (extension->str, "") != 0 && mi->user_ext[1]) - g_string_append (extension, ", "); - for (list = ((MimeInfo *) mi)->user_ext[1]; list; list=list->next) { - g_string_append (extension, (gchar *) list->data); - if (list->next != NULL) - g_string_append (extension, ", "); - } - ((MimeInfo *) mi)->ext_readable[1] = extension->str; - g_string_free (extension, FALSE); - - if (((MimeInfo *) mi)->ext[0] || ((MimeInfo *) mi)->user_ext[0]) { - extension = g_string_new ((((MimeInfo *) mi)->ext_readable[0])); - if (((MimeInfo *) mi)->ext[1] || ((MimeInfo *) mi)->user_ext[1]) { - g_string_append (extension, ", "); - g_string_append (extension, (((MimeInfo *) mi)->ext_readable[1])); - } - } else if (((MimeInfo *) mi)->ext[1] || ((MimeInfo *) mi)->user_ext[1]) - extension = g_string_new ((((MimeInfo *) mi)->ext_readable[1])); - else - extension = g_string_new (""); - g_string_free (extension, TRUE); -} -static void -finalize_user_mime () -{ - g_hash_table_foreach (user_mime_types, finalize_mime_type_foreach, NULL); - g_hash_table_foreach (initial_user_mime_types, finalize_mime_type_foreach, NULL); -} -void -init_mime_type (void) -{ - char *mime_info_dir; - - mime_types = g_hash_table_new (g_str_hash, g_str_equal); - initial_user_mime_types = g_hash_table_new (g_str_hash, g_str_equal); - user_mime_types = g_hash_table_new (g_str_hash, g_str_equal); - - mime_info_dir = gnome_unconditional_datadir_file ("mime-info"); - mime_load_from_dir (mime_info_dir, TRUE); - g_free (mime_info_dir); - - mime_info_dir = g_build_filename (gnome_util_user_home (), ".gnome/mime-info", NULL); - mime_load_from_dir (mime_info_dir, FALSE); - g_free (mime_info_dir); - finalize_user_mime (); - init_mime_info (); -} -void -add_new_mime_type (gchar *mime_type, gchar *raw_ext, gchar *regexp1, gchar *regexp2) -{ - gchar *temp; - MimeInfo *mi = NULL; - gint row; - gchar *ext = NULL; - gchar *ptr, *ptr2; - - /* first we make sure that the information is good */ - if (mime_type == NULL || *mime_type == '\000') { - run_error (_("You must enter a mime-type")); - return; - } else if ((raw_ext == NULL || *raw_ext == '\000') && - (regexp1 == NULL || *regexp1 == '\000') && - (regexp2 == NULL || *regexp2 == '\000')){ - run_error (_("You must add either a regular-expression or\na file-name extension")); - return; - } - if (strchr (mime_type, '/') == NULL) { - run_error (_("Please put your mime-type in the format:\nCATEGORY/TYPE\n\nFor Example:\nimage/png")); - return; - } - if (g_hash_table_lookup (user_mime_types, mime_type) || - g_hash_table_lookup (mime_types, mime_type)) { - run_error (_("This mime-type already exists")); - return; - } - if (raw_ext || *raw_ext) { - ptr2 = ext = g_malloc (sizeof (raw_ext)); - for (ptr = raw_ext;*ptr; ptr++) { - if (*ptr != '.' && *ptr != ',') { - *ptr2 = *ptr; - ptr2 += 1; - } - } - *ptr2 = '\000'; - } - /* passed check, now we add it. */ - if (ext) { - temp = g_strconcat ("ext: ", ext, NULL); - add_to_key (mime_type, temp, user_mime_types, TRUE); - mi = (MimeInfo *) g_hash_table_lookup (user_mime_types, mime_type); - g_free (temp); - } - if (regexp1) { - temp = g_strconcat ("regex: ", regexp1, NULL); - add_to_key (mime_type, temp, user_mime_types, TRUE); - g_free (temp); - } - if (regexp2) { - temp = g_strconcat ("regex,2: ", regexp2, NULL); - add_to_key (mime_type, temp, user_mime_types, TRUE); - g_free (temp); - } - /* Finally add it to the clist */ - if (mi) { - row = add_mime_vals_to_clist (mime_type, mi, clist); - gtk_clist_select_row (GTK_CLIST (clist), row, 0); - gtk_clist_moveto (GTK_CLIST (clist), row, 0, 0.5, 0.0); - } - g_free (ext); -} -static void -write_mime_foreach (gpointer mime_type, gpointer info, gpointer data) -{ - gchar *buf; - MimeInfo *mi = (MimeInfo *) info; - fwrite ((char *) mi->mime_type, 1, strlen ((char *) mi->mime_type), (FILE *) data); - fwrite ("\n", 1, 1, (FILE *) data); - if (mi->ext_readable[0]) { - fwrite ("\text: ", 1, strlen ("\text: "), (FILE *) data); - fwrite (mi->ext_readable[0], 1, - strlen (mi->ext_readable[0]), - (FILE *) data); - fwrite ("\n", 1, 1, (FILE *) data); - } - if (mi->regex_readable[0]) { - fwrite ("\tregex: ", 1, strlen ("\tregex: "), (FILE *) data); - fwrite (mi->regex_readable[0], 1, - strlen (mi->regex_readable[0]), - (FILE *) data); - fwrite ("\n", 1, 1, (FILE *) data); - } - if (mi->regex_readable[1]) { - fwrite ("\tregex,2: ", 1, strlen ("\tregex,2: "), (FILE *) data); - fwrite (mi->regex_readable[1], 1, - strlen (mi->regex_readable[1]), - (FILE *) data); - fwrite ("\n", 1, 1, (FILE *) data); - } - fwrite ("\n", 1, 1, (FILE *) data); -} - -static void -write_mime (GHashTable *hash) -{ - struct stat s; - gchar *dirname, *filename; - FILE *file; - GtkWidget *error_box; - - dirname = g_build_filename (gnome_util_user_home (), ".gnome/mime-info", NULL); - if ((stat (dirname, &s) < 0) || !(S_ISDIR (s.st_mode))){ - if (errno == ENOENT) { - if (mkdir (dirname, S_IRWXU) < 0) { - run_error (_("We are unable to create the directory\n" - "~/.gnome/mime-info\n\n" - "We will not be able to save the state.")); - return; - } - } else { - run_error (_("We are unable to access the directory\n" - "~/.gnome/mime-info\n\n" - "We will not be able to save the state.")); - return; - } - } - filename = g_build_filename (dirname, "user.mime", NULL); - - remove (filename); - file = fopen (filename, "w"); - if (file == NULL) { - run_error (_("Cannot create the file\n~/.gnome/mime-info/user.mime\n\n" - "We will not be able to save the state")); - return; - } - g_hash_table_foreach (hash, write_mime_foreach, file); - fclose (file); -} - -void -write_user_mime (void) -{ - write_mime (user_mime_types); -} - -void -write_initial_mime (void) -{ - write_mime (initial_user_mime_types); -} - -void -reread_list () -{ - gtk_clist_freeze (GTK_CLIST (clist)); - gtk_clist_clear (GTK_CLIST (clist)); - g_hash_table_foreach (mime_types, (GHFunc) add_mime_vals_to_clist, clist); - gtk_clist_thaw (GTK_CLIST (clist)); -} -static void -clean_mime_type (gpointer mime_type, gpointer mime_info, gpointer data) -{ - /* we should write this )-: */ -} -void -discard_mime_info () -{ - gchar *filename; - g_hash_table_foreach (user_mime_types, clean_mime_type, NULL); - g_hash_table_destroy (user_mime_types); - g_hash_table_foreach (initial_user_mime_types, clean_mime_type, NULL); - g_hash_table_destroy (initial_user_mime_types); - user_mime_types = g_hash_table_new (g_str_hash, g_str_equal); - initial_user_mime_types = g_hash_table_new (g_str_hash, g_str_equal); - - filename = g_build_filename (gnome_util_user_home (), "/.gnome/mime-info/user.keys", NULL); - mime_fill_from_file (filename, TRUE); - finalize_user_mime (); - reread_list (); - g_free (filename); -} - - - - - - - diff --git a/capplets/mime-type/mime-data.h b/capplets/mime-type/mime-data.h deleted file mode 100644 index f5c8bedea..000000000 --- a/capplets/mime-type/mime-data.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ -#ifndef _MIME_DATA_H_ -#define _MIME_DATA_H_ -#include "gnome.h" -#include -/* Typedefs */ -typedef struct { - char *mime_type; - regex_t *regex[2]; - GList *ext[2]; - GList *user_ext[2]; - char *ext_readable[2]; - char *regex_readable[2]; - char *file_name; - GList *keys; -} MimeInfo; - -extern GHashTable *user_mime_types; -extern void add_to_key (char *mime_type, char *def, GHashTable *table, gboolean init_user); - -GtkWidget *get_mime_clist (void); -void init_mime_type (void); -void delete_clicked (GtkWidget *widget, gpointer data); -void add_clicked (GtkWidget *widget, gpointer data); -void edit_clicked (GtkWidget *widget, gpointer data); -void add_new_mime_type (gchar *mime_type, gchar *ext, gchar *regexp1, gchar *regexp2); -void write_user_mime (void); -void write_initial_mime (void); -void reread_list (void); -void discard_mime_info (void); -#endif diff --git a/capplets/mime-type/mime-info.c b/capplets/mime-type/mime-info.c deleted file mode 100644 index a61811426..000000000 --- a/capplets/mime-type/mime-info.c +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "capplet-widget.h" -#include "gnome.h" -#include -#include -#include -#include -#include -#include "mime-info.h" -#include "mime-data.h" -#include -#include -#include -#include -#include - -#if !defined getc_unlocked && !defined HAVE_GETC_UNLOCKED -# define getc_unlocked(fp) getc (fp) -#endif - -typedef struct { - char *mime_type; - GHashTable *keys; -} GnomeMimeContext; - -typedef enum { - STATE_NONE, - STATE_LANG, - STATE_LOOKING_FOR_KEY, - STATE_ON_MIME_TYPE, - STATE_ON_KEY, - STATE_ON_VALUE -} ParserState; - -static char *current_lang = NULL; - -/* - * A hash table containing all of the Mime records for specific - * mime types (full description, like image/png) - */ -static GHashTable *specific_types; -static GHashTable *initial_specific_types; - -/* - * A hash table containing all of the Mime records for non-specific - * mime types (like image/\*) - */ -static GHashTable *generic_types; -static GHashTable *initial_generic_types; - -#define SWITCH_TO_MIME_TYPE() { -static GnomeMimeContext * -context_new (GString *str, gboolean is_default_context) -{ - GnomeMimeContext *context; - GHashTable *table; - char *mime_type, *p; - - mime_type = g_strdup (str->str); - - if (is_default_context) { - if ((p = strstr (mime_type, "/*")) == NULL){ - table = initial_specific_types; - } else { - *(p+1) = 0; - table = initial_generic_types; - } - } else { - if ((p = strstr (mime_type, "/*")) == NULL){ - table = specific_types; - } else { - *(p+1) = 0; - table = generic_types; - } - } - context = g_hash_table_lookup (table, mime_type); - - if (context) - return context; - - context = g_new (GnomeMimeContext, 1); - context->mime_type = mime_type; - context->keys = g_hash_table_new (g_str_hash, g_str_equal); - - g_hash_table_insert (table, context->mime_type, context); - return context; -} - -static gboolean -release_key_and_value (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - g_free (value); - - return TRUE; -} - - -static gboolean -remove_this_key (gpointer key, gpointer value, gpointer user_data) -{ - if (strcmp ((gchar *)key, (gchar *)user_data) == 0){ - g_free (key); - g_free (value); - return TRUE; - } - - return FALSE; -} -static void -context_add_key (GnomeMimeContext *context, char *key, char *value) -{ - char *v; - - v = g_hash_table_lookup (context->keys, key); - if (v) - g_hash_table_foreach_remove (context->keys, remove_this_key, key); - - g_hash_table_insert (context->keys, g_strdup (key), g_strdup (value)); -} -static void -context_destroy (GnomeMimeContext *context) -{ - /* - * Remove the context from our hash tables, we dont know - * where it is: so just remove it from both (it can - * only be in one). - */ - if (context->mime_type) { - g_hash_table_remove (specific_types, context->mime_type); - g_hash_table_remove (generic_types, context->mime_type); - } - /* - * Destroy it - */ - if (context->keys) { - g_hash_table_foreach_remove (context->keys, release_key_and_value, NULL); - g_hash_table_destroy (context->keys); - } - g_free (context->mime_type); - g_free (context); -} - -static void -load_mime_type_info_from (char *filename) -{ - FILE *mime_file; - gboolean in_comment, context_used; - GString *line; - int column, c; - ParserState state; - GnomeMimeContext *context, *default_context; - char *key; - - mime_file = fopen (filename, "r"); - if (mime_file == NULL) - return; - - in_comment = FALSE; - context_used = FALSE; - column = 0; - context = NULL; - default_context = NULL; - key = NULL; - line = g_string_sized_new (120); - state = STATE_NONE; - - while ((c = getc_unlocked (mime_file)) != EOF){ - column++; - if (c == '\r') - continue; - - if (c == '#' && column == 0){ - in_comment = TRUE; - continue; - } - - if (c == '\n'){ - in_comment = FALSE; - column = 0; - if (state == STATE_ON_MIME_TYPE){ - context = context_new (line, FALSE); - default_context = context_new (line, TRUE); - context_used = FALSE; - g_string_assign (line, ""); - state = STATE_LOOKING_FOR_KEY; - continue; - } - if (state == STATE_ON_VALUE){ - context_used = TRUE; - context_add_key (context, key, line->str); - context_add_key (default_context, key, line->str); - g_string_assign (line, ""); - g_free (key); - key = NULL; - state = STATE_LOOKING_FOR_KEY; - continue; - } - continue; - } - - if (in_comment) - continue; - - switch (state){ - case STATE_NONE: - if (c != ' ' && c != '\t') - state = STATE_ON_MIME_TYPE; - else - break; - /* fall down */ - - case STATE_ON_MIME_TYPE: - if (c == ':'){ - in_comment = TRUE; - break; - } - g_string_append_c (line, c); - break; - - case STATE_LOOKING_FOR_KEY: - if (c == '\t' || c == ' ') - break; - - if (c == '['){ - state = STATE_LANG; - break; - } - - if (column == 1){ - state = STATE_ON_MIME_TYPE; - g_string_append_c (line, c); - break; - } - state = STATE_ON_KEY; - /* falldown */ - - case STATE_ON_KEY: - if (c == '\\'){ - c = getc (mime_file); - if (c == EOF) - break; - } - if (c == '='){ - key = g_strdup (line->str); - g_string_assign (line, ""); - state = STATE_ON_VALUE; - break; - } - g_string_append_c (line, c); - break; - - case STATE_ON_VALUE: - g_string_append_c (line, c); - break; - - case STATE_LANG: - if (c == ']'){ - state = STATE_ON_KEY; - if (current_lang && line->str [0]){ - if (strcmp (current_lang, line->str) != 0){ - in_comment = TRUE; - state = STATE_LOOKING_FOR_KEY; - } - } else { - in_comment = TRUE; - state = STATE_LOOKING_FOR_KEY; - } - g_string_assign (line, ""); - break; - } - g_string_append_c (line, c); - break; - } - } - - if (context){ - if (key && line->str [0]) { - context_add_key (context, key, line->str); - context_add_key (default_context, key, line->str); - } else - if (!context_used) { - context_destroy (context); - context_destroy (default_context); - } - - } - - g_string_free (line, TRUE); - if (key) - g_free (key); - - fclose (mime_file); -} -void -set_mime_key_value (gchar *mime_type, gchar *key, gchar *value) -{ - GnomeMimeContext *context; - - /* Assume no generic context's for now. */ - context = g_hash_table_lookup (specific_types, mime_type); - if (context == NULL) { - GString *str = g_string_new (mime_type); - context = context_new (str, FALSE); - g_string_free (str, TRUE); - } - context_add_key (context, key, value); -} -void -init_mime_info (void) -{ - gchar *filename; - - current_lang = getenv ("LANG"); - specific_types = g_hash_table_new (g_str_hash, g_str_equal); - generic_types = g_hash_table_new (g_str_hash, g_str_equal); - initial_specific_types = g_hash_table_new (g_str_hash, g_str_equal); - initial_generic_types = g_hash_table_new (g_str_hash, g_str_equal); - - filename = g_build_filename (gnome_util_user_home (), "/.gnome/mime-info/user.keys", NULL); - load_mime_type_info_from (filename); - g_free (filename); -} - -const char * -local_mime_get_value (const char *mime_type, char *key) -{ - char *value, *generic_type, *p; - GnomeMimeContext *context; - - g_return_val_if_fail (mime_type != NULL, NULL); - g_return_val_if_fail (key != NULL, NULL); - context = g_hash_table_lookup (specific_types, mime_type); - if (context){ - value = g_hash_table_lookup (context->keys, key); - - if (value) - return value; - } - - generic_type = g_strdup (mime_type); - p = strchr (generic_type, '/'); - if (p) - *(p+1) = 0; - - context = g_hash_table_lookup (generic_types, generic_type); - g_free (generic_type); - - if (context){ - value = g_hash_table_lookup (context->keys, key); - if (value) - return value; - } - return NULL; -} -static void -clean_mime_foreach (gpointer mime_type, gpointer gmc, gpointer data) -{ - context_destroy ((GnomeMimeContext *) gmc); -} -static void -write_mime_keys_foreach (gpointer key_name, gpointer value, gpointer data) -{ - gchar *buf; - if (current_lang && strcmp (current_lang, "C")) - buf = g_strconcat ("\t[", - current_lang, - "]", - (gchar *) key_name, - "=", - (gchar *) value, - "\n", NULL); - else - buf = g_strconcat ("\t", - (gchar *) key_name, - "=", - (gchar *) value, - "\n", NULL); - fwrite (buf, 1, strlen (buf), (FILE *) data); - g_free (buf); -} -static void -write_mime_foreach (gpointer mime_type, gpointer gmc, gpointer data) -{ - gchar *buf; - GnomeMimeContext *context = (GnomeMimeContext *) gmc; - - buf = g_strconcat ((gchar *) mime_type, ":\n", NULL); - fwrite (buf, 1, strlen (buf), (FILE *) data); - g_free (buf); - g_hash_table_foreach (context->keys, write_mime_keys_foreach, data); - fwrite ("\n", 1, strlen ("\n"), (FILE *) data); -} - -static void -run_error (gchar *message) -{ - GtkWidget *error_box; - - error_box = gnome_message_box_new ( - message, - GNOME_MESSAGE_BOX_ERROR, - GNOME_STOCK_BUTTON_OK, - NULL); - gnome_dialog_run_and_close (GNOME_DIALOG (error_box)); -} -static void -write_keys (GHashTable *spec_hash, GHashTable *generic_hash) -{ - struct stat s; - gchar *dirname, *filename; - FILE *file; - GtkWidget *error_box; - - dirname = g_build_filename (gnome_util_user_home (), ".gnome/mime-info", NULL); - if ((stat (dirname, &s) < 0) || !(S_ISDIR (s.st_mode))){ - if (errno == ENOENT) { - if (mkdir (dirname, S_IRWXU) < 0) { - run_error (_("We are unable to create the directory\n" - "~/.gnome/mime-info\n\n" - "We will not be able to save the state.")); - return; - } - } else { - run_error (_("We are unable to access the directory\n" - "~/.gnome/mime-info\n\n" - "We will not be able to save the state.")); - return; - } - } - filename = g_build_filename (dirname, "user.keys", NULL); - - remove (filename); - file = fopen (filename, "w"); - if (file == NULL) { - run_error (_("Cannot create the file\n~/.gnome/mime-info/user.keys.\n\n" - "We will not be able to save the state")); - return; - } - g_hash_table_foreach (spec_hash, write_mime_foreach, file); - g_hash_table_foreach (generic_hash, write_mime_foreach, file); - fclose (file); -} -void -write_initial_keys (void) -{ - write_keys (initial_generic_types, initial_specific_types); -} -void -write_user_keys (void) -{ - write_keys (generic_types, specific_types); -} -static void -print_mime_foreach (gpointer mime_info, gpointer mi, gpointer data) -{ - g_print ("mime_info:%s:\n", (char *)mime_info); - g_print ("\t:%s:\n", ((MimeInfo *)mi)->mime_type); -} -void -discard_key_info (void) -{ - gchar *filename; - - current_lang = getenv ("LANG"); - g_hash_table_foreach (generic_types, clean_mime_foreach, NULL); -/* g_hash_table_foreach (specific_types, print_mime_foreach, NULL); */ - g_hash_table_foreach (specific_types, clean_mime_foreach, NULL); - g_hash_table_destroy (generic_types); - g_hash_table_destroy (specific_types); - specific_types = g_hash_table_new (g_str_hash, g_str_equal); - generic_types = g_hash_table_new (g_str_hash, g_str_equal); - - filename = g_build_filename (gnome_util_user_home (), "/.gnome/mime-info/user.keys", NULL); - load_mime_type_info_from (filename); - reread_list (); - g_free (filename); -} -void -remove_mime_info (gchar *mime_type) -{ - g_hash_table_remove (generic_types, mime_type); - g_hash_table_remove (specific_types, mime_type); -} diff --git a/capplets/mime-type/mime-info.h b/capplets/mime-type/mime-info.h deleted file mode 100644 index 18db2326f..000000000 --- a/capplets/mime-type/mime-info.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ -#ifndef _MIME_INFO_H_ -#define _MIME_INFO_H_ -#include "gnome.h" -#include -/* Typedefs */ -void init_mime_info (void); -void discard_key_info (void); -void set_mime_key_value (gchar *mime_type, gchar *key, gchar *value); -const char * local_mime_get_value (const char *mime_type, char *key); -void write_user_keys (void); -void write_initial_keys (void); -void remove_mime_info (gchar *mime_type); -#endif diff --git a/capplets/mime-type/mime-type-capplet.c b/capplets/mime-type/mime-type-capplet.c deleted file mode 100644 index 6018b92f7..000000000 --- a/capplets/mime-type/mime-type-capplet.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "capplet-widget.h" -#include "gnome.h" -#include -#include -#include -#include -#include -#include "mime-data.h" -#include "mime-info.h" -#include "edit-window.h" -/* Prototypes */ -static void try_callback (); -static void revert_callback (); -static void ok_callback (); -static void cancel_callback (); -static void help_callback (); -GtkWidget *capplet = NULL; -GtkWidget *delete_button = NULL; - -static GtkWidget * -left_aligned_button (gchar *label) -{ - GtkWidget *button = gtk_button_new_with_label (label); - gtk_misc_set_alignment (GTK_MISC (GTK_BIN (button)->child), - 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), - GNOME_PAD_SMALL, 0); - - return button; -} - -static void -try_callback () -{ - write_user_keys (); - write_user_mime (); -} -static void -revert_callback () -{ - write_initial_keys (); - write_initial_mime (); - discard_key_info (); - discard_mime_info (); - initialize_main_win_vals (); -} -static void -ok_callback () -{ - write_user_keys (); - write_user_mime (); -} -static void -cancel_callback () -{ - write_initial_keys (); - write_initial_mime (); -} - -static void -help_callback () -{ - /* Sigh... empty as always */ -} - -static void -init_mime_capplet () -{ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *button; - - capplet = capplet_widget_new (); - delete_button = left_aligned_button (_("Delete")); - gtk_signal_connect (GTK_OBJECT (delete_button), "clicked", - delete_clicked, NULL); - - hbox = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (capplet), hbox); - gtk_box_pack_start (GTK_BOX (hbox), get_mime_clist (), TRUE, TRUE, 0); - vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); - button = left_aligned_button (_("Add...")); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - add_clicked, NULL); - button = left_aligned_button (_("Edit...")); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - edit_clicked, NULL); - gtk_box_pack_start (GTK_BOX (vbox), delete_button, FALSE, FALSE, 0); - gtk_widget_show_all (capplet); - gtk_signal_connect(GTK_OBJECT(capplet), "try", - GTK_SIGNAL_FUNC(try_callback), NULL); - gtk_signal_connect(GTK_OBJECT(capplet), "revert", - GTK_SIGNAL_FUNC(revert_callback), NULL); - gtk_signal_connect(GTK_OBJECT(capplet), "ok", - GTK_SIGNAL_FUNC(ok_callback), NULL); - gtk_signal_connect(GTK_OBJECT(capplet), "cancel", - GTK_SIGNAL_FUNC(cancel_callback), NULL); - gtk_signal_connect(GTK_OBJECT(capplet), "page_hidden", - GTK_SIGNAL_FUNC(hide_edit_window), NULL); - gtk_signal_connect(GTK_OBJECT(capplet), "page_shown", - GTK_SIGNAL_FUNC(show_edit_window), NULL); -#if 0 - gtk_signal_connect(GTK_OBJECT(capplet), "help", - GTK_SIGNAL_FUNC(help_callback), NULL); -#endif -} - -int -main (int argc, char **argv) -{ - int init_results; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (PACKAGE, "UTF-8"); - textdomain (PACKAGE); - - init_results = gnome_capplet_init("mime-type", 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; -} diff --git a/capplets/mime-type/mime-type-capplet.png b/capplets/mime-type/mime-type-capplet.png deleted file mode 100644 index b253d29fe..000000000 Binary files a/capplets/mime-type/mime-type-capplet.png and /dev/null differ diff --git a/capplets/mime-type/mime-type-properties.glade b/capplets/mime-type/mime-type-properties.glade deleted file mode 100644 index e69de29bb..000000000 diff --git a/capplets/mime-type/mime-type.desktop.in.in b/capplets/mime-type/mime-type.desktop.in.in deleted file mode 100644 index 3ca034881..000000000 --- a/capplets/mime-type/mime-type.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=Mime Types -_Comment=Configure how files are associated and started -Icon=mime-type-capplet.png -Exec=mime-type-capplet -Terminal=0 -Type=Application diff --git a/capplets/mime-type/new-mime-window.c b/capplets/mime-type/new-mime-window.c deleted file mode 100644 index bc21109b7..000000000 --- a/capplets/mime-type/new-mime-window.c +++ /dev/null @@ -1,120 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "new-mime-window.h" -#include "capplet-widget.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 *regex1_entry; - GtkWidget *regex2_entry; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - - 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); - - frame = gtk_frame_new (_("Regular Expressions")); - 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 (_("You can set up two regular expressions here to identify the Mime Type\nby. These fields are optional.")); - 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); - gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0); - table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL); -/* gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD_SMALL);*/ - label = gtk_label_new (_("First Regular Expression: ")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_table_attach (GTK_TABLE (table), - label, - 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - regex1_entry = gtk_entry_new (); - gtk_table_attach_defaults (GTK_TABLE (table), - regex1_entry, - 1, 2, 0, 1); - label = gtk_label_new (_("Second Regular Expression: ")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_table_attach (GTK_TABLE (table), - label, - 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - regex2_entry = gtk_entry_new (); - gtk_table_attach_defaults (GTK_TABLE (table), - regex2_entry, - 1, 2, 1, 2); - gtk_box_pack_start (GTK_BOX (vbox), table, 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)), - gtk_entry_get_text (GTK_ENTRY (regex1_entry)), - gtk_entry_get_text (GTK_ENTRY (regex2_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); -} diff --git a/capplets/mime-type/new-mime-window.h b/capplets/mime-type/new-mime-window.h deleted file mode 100644 index 3071ab3fd..000000000 --- a/capplets/mime-type/new-mime-window.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ -/* Copyright (C) 1998 Redhat Software Inc. - * Authors: Jonathan Blandford - */ -#include "mime-data.h" -#ifndef _NEW_MIME_WINDOW_H_ -#define _NEW_MIME_WINDOW_H_ - -void launch_new_mime_window (void); -void hide_new_mime_window (void); -void show_new_mime_window (void); - -#endif - diff --git a/capplets/rollback/ChangeLog b/capplets/rollback/ChangeLog deleted file mode 100644 index f872d71c7..000000000 --- a/capplets/rollback/ChangeLog +++ /dev/null @@ -1,196 +0,0 @@ -2004-10-14 Jody Goldberg - - * Release 2.8.1 - -2004-04-15 Jody Goldberg - - * Release 2.6.1 - -2004-04-01 Jody Goldberg - - * Release 2.6.0.3 - -2004-03-30 Jody Goldberg - - * Release 2.6.0.1 - -2004-03-23 Jody Goldberg - - * Release 2.6.0 - -2004-03-11 Jody Goldberg - - * Release 2.5.4 - -2004-02-13 Jody Goldberg - - * Release 2.5.3 - -2004-01-14 Jody Goldberg - - * Release 2.5.2 - -2003-12-30 Jody Goldberg - - * Release 2.5.1.1 - -2003-12-30 Jody Goldberg - - * Release 2.5.1 - -2003-10-28 Jody Goldberg - - * Release 2.5.0 - -2003-07-07 Jody Goldberg - - * Release 2.3.4 - -2003-06-24 Jody Goldberg - - * Release 2.3.3 - -2003-05-07 Jody Goldberg - - * Release 2.3.1 - -Tue Feb 4 17:09:18 2003 Jonathan Blandford - - * Release 2.2.0.1 - -Tue Jan 21 01:15:14 2003 Jonathan Blandford - - * Release 2.2.0 - -Thu Jan 16 02:41:09 2003 Jonathan Blandford - - * Release 2.1.7 - -2003-01-10 Jody Goldberg - - * Release 2.1.6 - -2002-12-18 Jody Goldberg - - * Release 2.1.5 - -2002-11-23 Jody Goldberg - - * Release 2.1.3 - -2002-11-02 Jody Goldberg - - * Release 2.1.2 - -2002-10-21 Jody Goldberg - - * Release 2.1.1 - -2002-10-01 Jody Goldberg - - * Release 2.1.0.1 - -2002-08-21 Jody Goldberg - - * Release 2.1.0 - -2002-06-17 Jody Goldberg - - * Release 2.0.0 - -2002-02-27 Kjartan Maraas - - * main.c: s/PACKAGE/GETTEXT_PACKAGE/g - -2001-10-15 Jakub Steiner - - * rollback-capplet.png: the applet icon - -2001-09-14 Bradford Hovinen - - * rollback-capplet-dialog.c (rollback_capplet_dialog_init): Create - apply and close buttons, ala the setup tools - -2001-07-27 Bradford Hovinen - - * RELEASE : 1.5.2 - -2001-07-20 Chema Celorio - - * RELEASE : 1.5.0 - -2001-07-10 Kai Lahmann - - * rollback.desktop: added german translation - -2001-07-05 Bradford Hovinen - - * config-manager-dialog.c: Update #include locations - - * Makefile.am (INCLUDES): - (rollback_capplet_LDADD): Update to include ximian_archiver stuff - correctly - -2001-01-29 Bradford Hovinen - - * rollback-widget.c (rollback_widget_realize): Check entire - success array and warn if any allocation did not succeed - - * config-manager-dialog.c (cancel_cb): Don't do rollback - - * Makefile.am (rollback_capplet_SOURCES): Added rollback-control.[ch] - - * config-manager-dialog.c (config_manager_dialog_init): Construct - a rollback widget with a rollback control and place it in the - dialog - -2001-01-27 Bradford Hovinen - - * rollback-widget.c (rollback_widget_realize): Allocate control - colors - - * rollback-widget.h (struct _RollbackWidget ): Added array - control_colors - - * rollback-widget.c (rollback_widget_realize): - (rollback_widget_unrealize): Implement. Just calls the parent's - [un]realize and creates/destroys a GC to be used by the individual - controls. - (rollback_widget_get_gc): Implement. Return the GC created above - -2001-01-25 Bradford Hovinen - - * main.c (main): Support operating on global backends - Add popt option for operating on global backends - -2001-01-24 Bradford Hovinen - - * config-manager-dialog.c (config_manager_dialog_finalize): Update - unrefs - (config_manager_dialog_init): GLADE_DIR -> GLADE_DATADIR - (config_manager_dialog_init): Remove outdated signal connections - (config_manager_dialog_init): Remove code to create location list - Inherit from CappletWidget rather than GnomeDialog - (config_manager_dialog_init): Remove gtk_window_set_policy call - (ok_cb): - (cancel_cb): Remove gnome_dialog_close call - (config_manager_dialog_init): Set state to "changed" so that the - Ok button is active - (populate_backends_cb): Set backend_id in dialog if not already set - - * Makefile.am (INCLUDES): Changed CAPPLET_CFLAGS to - ROLLBACK_CAPPLET_CFLAGS - (rollback_capplet_LDADD): Ditto for CAPPLET_LIBS - - * config-manager-dialog.c: Remove #include - "create-location-dialog.h" and #include "location-list.h"; set all - the includes from libarchiver to get their files from the right - directory - -2001-01-18 Bradford Hovinen - - * config-manager-dialog.c (do_rollback): Rewrite, add boolean - rollback_to_last to signature - - * config-manager-dialog.h: Change base class to CappletWidget - diff --git a/capplets/rollback/Makefile.am b/capplets/rollback/Makefile.am deleted file mode 100644 index e7e7830f8..000000000 --- a/capplets/rollback/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -cappletname = rollback -cappletgroup = - -bin_PROGRAMS = rollback-capplet - -rollback_capplet_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(top_builddir)/archiver/libconfig_archiver.la - -rollback_capplet_SOURCES = \ - rollback-capplet-dialog.c rollback-capplet-dialog.h \ - main.c - -@INTLTOOL_DESKTOP_RULE@ - -####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@ -$(desktop).in: %.desktop.in: %.desktop.in.in - sed -e "s#@DESKTOP_EXEC_LINE@#$(DESKTOP_EXEC_LINE)#" -e "s#Icon=.*#Icon=$(pkgdatadir)/icons/${cappletname}-capplet.png#" < $< > ${cappletname}.desktop.in - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup) - $(INSTALL_DATA) $(desktop) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)$(desktop) - -install-data-am: install-data-local -####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@ - -INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) -CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) -EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) -iconsdir = $(pkgdatadir)/icons -Gladedir = $(pkgdatadir)/glade -pixmapdir = $(pkgdatadir)/pixmaps -Glade_DATA = $(cappletname).glade -icons_DATA = $(cappletname)-capplet.png -desktop = $(cappletname).desktop -all-local: $(desktop) diff --git a/capplets/rollback/TODO b/capplets/rollback/TODO deleted file mode 100644 index fa0155866..000000000 --- a/capplets/rollback/TODO +++ /dev/null @@ -1,28 +0,0 @@ -Short-term - * Accept command line argument to allow rollback of a specific backend - * Remove backends list and rely on the above command line argument - * Add logic in the control center to activate this capplet with the - appropriate command line argument from menu items or a control - connected with each capplet - * Something that tells the user when he tries to go back so far in - time that there is no configuration available from that date - * Have config manager dialog set flag when rolling back and, upon - cancel, only roll forward if that flag is set - -Long(er)-term - * Somehow fix this so that the user sees the old configurations as he - selects a time. The selection should be a slider that the user slides - back and forth to roll forwards and backwards, and the user should see - the configuration settings as reflected in the position of the slider. - - This could just be put into libcapplet, so that the user - sees this slider at all times. That could be a bit much for a lot of - users, though. - - This could be a bonobo component, acting as a container for - capplets (which are then bonobo controls). - - This could be a feature of libcapplet enabled by a command - line switch - -Done - * Get this thing to actually work - * Accept command line argument to tell whether it's going to be user - or global diff --git a/capplets/rollback/main.c b/capplets/rollback/main.c deleted file mode 100644 index 02ca69fb3..000000000 --- a/capplets/rollback/main.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* main.c - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "rollback-capplet-dialog.h" - -static gboolean is_global; -static gchar *capplet_name; - -static struct poptOption rollback_options[] = { - {"capplet", 'c', POPT_ARG_STRING, &capplet_name, 0, - N_("Rollback the capplet given")}, - {"global", 'g', POPT_ARG_NONE, &is_global, 0, - N_("Operate on global backends")}, - {NULL, '\0', 0, NULL, 0} -}; - -int -main (int argc, char **argv) -{ - CORBA_ORB orb; - GtkObject *dialog; - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - gnomelib_register_popt_table (rollback_options, - _("Options for the rollback GUI")); - - gnome_init ("config-manager", VERSION, argc, argv); - glade_gnome_init (); - - orb = oaf_init (argc, argv); - if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error ("Cannot initialize bonobo"); - - if (capplet_name != NULL) { - dialog = rollback_capplet_dialog_new (capplet_name); - - if (dialog == NULL) { - g_critical ("Could not create rollback dialog"); - return -1; - } else { - gtk_widget_show (GTK_WIDGET (dialog)); - gtk_signal_connect (dialog, "destroy", gtk_main_quit, NULL); - } - } - - bonobo_main (); - - return 0; -} diff --git a/capplets/rollback/rollback-capplet-dialog.c b/capplets/rollback/rollback-capplet-dialog.c deleted file mode 100644 index 7cd020a15..000000000 --- a/capplets/rollback/rollback-capplet-dialog.c +++ /dev/null @@ -1,592 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-capplet-dialog.c - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include -#include - -#include "rollback-capplet-dialog.h" - -static const gchar date_mod_units[] = { - 'y', 'M', 'M', 'd', 'd', 'd', 'h', 'm', 'm', 'm', 'm', '\0' -}; - -static const gint date_mod_values[] = { - -1, -6, -1, -7, -3, -1, -1, -30, -10, -5, -1, 0 -}; - -static const gchar *labels[] = { - N_("1 year ago"), N_("6 months ago"), N_("1 month ago"), N_("1 week ago"), - N_("3 days ago"), N_("1 day ago"), N_("1 hour ago"), N_("30 minutes ago"), - N_("10 minutes ago"), N_("5 minutes ago"), N_("1 minute ago"), N_("Current time") -}; - -#define NUM_ROLLBACK_LEVELS (sizeof (labels) / sizeof (const gchar *)) - -enum { - ARG_0, - ARG_CAPPLET_NAME -}; - -struct _RollbackCappletDialogPrivate -{ - GladeXML *data; - GtkWidget *contents; - GtkWidget *control_socket; - GtkWidget *label; - gchar *capplet_name; - gchar *capplet_moniker_name; - - Bonobo_PropertyControl property_control; - Bonobo_PropertyBag control_pb; - - guint rollback_level; - - struct tm mod_dates[NUM_ROLLBACK_LEVELS - 1]; -}; - -static GnomeDialogClass *parent_class; - -static void rollback_capplet_dialog_init (RollbackCappletDialog *rollback_capplet_dialog); -static void rollback_capplet_dialog_class_init (RollbackCappletDialogClass *class); - -static void rollback_capplet_dialog_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void rollback_capplet_dialog_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); - -static void rollback_capplet_dialog_destroy (GtkObject *object); -static void rollback_capplet_dialog_finalize (GtkObject *object); - -static gchar *get_moniker (gchar *capplet_name, - struct tm *date); -static void get_modified_date (guint rollback_level, - struct tm *date); -static gboolean do_setup (RollbackCappletDialog *dialog); -static void apply_settings (RollbackCappletDialog *dialog); - -static gboolean is_leap_year (guint year); -static void mod_date_by_str (struct tm *date, - gint value, - gchar unit); - -static void rollback_changed_cb (RollbackCappletDialog *dialog, - GtkAdjustment *adj); -static void apply_cb (GtkButton *button, - RollbackCappletDialog *dialog); -static void close_cb (GtkButton *button, - RollbackCappletDialog *dialog); - -GType -rollback_capplet_dialog_get_type (void) -{ - static GType rollback_capplet_dialog_type = 0; - - if (!rollback_capplet_dialog_type) { - GtkTypeInfo rollback_capplet_dialog_info = { - "RollbackCappletDialog", - sizeof (RollbackCappletDialog), - sizeof (RollbackCappletDialogClass), - (GtkClassInitFunc) rollback_capplet_dialog_class_init, - (GtkObjectInitFunc) rollback_capplet_dialog_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - rollback_capplet_dialog_type = - gtk_type_unique (gnome_dialog_get_type (), - &rollback_capplet_dialog_info); - } - - return rollback_capplet_dialog_type; -} - -static void -rollback_capplet_dialog_init (RollbackCappletDialog *dialog) -{ - GtkAdjustment *adj; - GtkWidget *range; - GladeXML *data; - - static const gchar *buttons[] = { - GNOME_STOCK_BUTTON_APPLY, - GNOME_STOCK_BUTTON_CLOSE, - NULL - }; - - data = glade_xml_new (GNOMECC_GLADE_DIR "/rollback.glade", "rollback_dialog"); - - if (data == NULL) { - g_critical ("Your Glade file is either missing or corrupt."); - dialog->p = (gpointer) 0xdeadbeef; - return; - } - - dialog->p = g_new0 (RollbackCappletDialogPrivate, 1); - dialog->p->data = data; - dialog->p->contents = glade_xml_get_widget (dialog->p->data, "rollback_dialog"); - dialog->p->control_socket = glade_xml_get_widget (dialog->p->data, "control_socket"); - dialog->p->label = glade_xml_get_widget (dialog->p->data, "rollback_level_label"); - dialog->p->rollback_level = 12; - - range = glade_xml_get_widget (dialog->p->data, "rollback_scale"); - adj = GTK_ADJUSTMENT (gtk_adjustment_new (12, 0, 12, 1, 1, 1)); - gtk_range_set_adjustment (GTK_RANGE (range), adj); - gtk_signal_connect_object (GTK_OBJECT (adj), "value-changed", - GTK_SIGNAL_FUNC (rollback_changed_cb), GTK_OBJECT (dialog)); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), dialog->p->contents, TRUE, TRUE, 0); - - gnome_dialog_constructv (GNOME_DIALOG (dialog), _("Rollback"), buttons); - - gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0, GTK_SIGNAL_FUNC (apply_cb), dialog); - gnome_dialog_button_connect (GNOME_DIALOG (dialog), 1, GTK_SIGNAL_FUNC (close_cb), dialog); -} - -static void -rollback_capplet_dialog_class_init (RollbackCappletDialogClass *class) -{ - GtkObjectClass *object_class; - - gtk_object_add_arg_type ("RollbackCappletDialog::capplet-name", - GTK_TYPE_POINTER, - GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, - ARG_CAPPLET_NAME); - - object_class = GTK_OBJECT_CLASS (class); - object_class->destroy = rollback_capplet_dialog_destroy; - object_class->finalize = rollback_capplet_dialog_finalize; - object_class->set_arg = rollback_capplet_dialog_set_arg; - object_class->get_arg = rollback_capplet_dialog_get_arg; - - parent_class = GNOME_DIALOG_CLASS - (gtk_type_class (gnome_dialog_get_type ())); -} - -static void -rollback_capplet_dialog_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackCappletDialog *dialog; - gchar *tmp; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CAPPLET_DIALOG (object)); - - dialog = ROLLBACK_CAPPLET_DIALOG (object); - - if (dialog->p == (gpointer) 0xdeadbeef) - return; - - switch (arg_id) { - case ARG_CAPPLET_NAME: - g_return_if_fail (GTK_VALUE_POINTER (*arg) != NULL); - - dialog->p->capplet_name = GTK_VALUE_POINTER (*arg); - - dialog->p->capplet_moniker_name = g_strdup (dialog->p->capplet_name); - if ((tmp = strstr (dialog->p->capplet_moniker_name, "-capplet")) != NULL) *tmp = '\0'; - - break; - - default: - g_warning ("Bad argument set"); - break; - } -} - -static void -rollback_capplet_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackCappletDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CAPPLET_DIALOG (object)); - - dialog = ROLLBACK_CAPPLET_DIALOG (object); - - switch (arg_id) { - case ARG_CAPPLET_NAME: - GTK_VALUE_POINTER (*arg) = dialog->p->capplet_name; - break; - - default: - g_warning ("Bad argument get"); - break; - } -} - -static void -rollback_capplet_dialog_destroy (GtkObject *object) -{ - RollbackCappletDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CAPPLET_DIALOG (object)); - - dialog = ROLLBACK_CAPPLET_DIALOG (object); - - if (dialog->p != (gpointer) 0xdeadbeef) { - bonobo_object_release_unref (dialog->p->property_control, NULL); - bonobo_object_release_unref (dialog->p->control_pb, NULL); - gtk_object_destroy (GTK_OBJECT (dialog->p->data)); - } - - if (dialog->p->capplet_name != NULL) { - g_free (dialog->p->capplet_name); - dialog->p->capplet_name = NULL; - } - - if (dialog->p->capplet_moniker_name != NULL) { - g_free (dialog->p->capplet_moniker_name); - dialog->p->capplet_moniker_name = NULL; - } - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -rollback_capplet_dialog_finalize (GtkObject *object) -{ - RollbackCappletDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CAPPLET_DIALOG (object)); - - dialog = ROLLBACK_CAPPLET_DIALOG (object); - - if (dialog->p != (gpointer) 0xdeadbeef) - g_free (dialog->p); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - -GtkObject * -rollback_capplet_dialog_new (gchar *capplet_name) -{ - GtkObject *object; - - object = gtk_object_new (rollback_capplet_dialog_get_type (), - "capplet-name", capplet_name, - NULL); - - if (ROLLBACK_CAPPLET_DIALOG (object)->p == (gpointer) 0xdeadbeef) { - gtk_object_destroy (object); - return NULL; - } - - if (do_setup (ROLLBACK_CAPPLET_DIALOG (object))) { - return object; - } else { - gtk_object_destroy (object); - return NULL; - } -} - -static gchar * -get_moniker (gchar *capplet_name, struct tm *date) -{ - if (date == NULL) - return g_strconcat ("archive:user-archive#archiverdb:", capplet_name, NULL); - else - return g_strdup_printf - ("archive:user-archive#archiverdb:[|%04d%02d%02d%02d%02d%02d]%s", - date->tm_year + 1900, date->tm_mon + 1, date->tm_mday, - date->tm_hour, date->tm_min, date->tm_sec, capplet_name); -} - -static void -get_modified_date (guint rollback_level, struct tm *date) -{ - time_t t; - - t = time (NULL); - gmtime_r (&t, date); - mod_date_by_str (date, date_mod_values[rollback_level], date_mod_units[rollback_level]); -} - -/* do_setup - * - * Sets up the dialog's controls - * - * Returns TRUE on success and FALSE on failure - */ - -static gboolean -do_setup (RollbackCappletDialog *dialog) -{ - CORBA_Environment ev; - Bonobo_Control control; - - BonoboControlFrame *cf; - - GtkWidget *control_wid; - GtkWidget *err_dialog; - - gchar *tmp, *tmp1; - gchar *oaf_iid; - gchar *moniker; - - guint i; - - CORBA_exception_init (&ev); - - tmp = g_strdup (dialog->p->capplet_moniker_name); - while ((tmp1 = strchr (tmp, '-'))) *tmp1 = '_'; - - oaf_iid = g_strconcat ("OAFIID:Bonobo_Control_Capplet_", tmp, NULL); - dialog->p->property_control = bonobo_get_object (oaf_iid, "IDL:Bonobo/PropertyControl:1.0", &ev); - g_free (oaf_iid); - g_free (tmp); - - if (BONOBO_EX (&ev) || dialog->p->property_control == CORBA_OBJECT_NIL) { - err_dialog = gnome_error_dialog ("Could not load the capplet."); - gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog)); - return FALSE; - } - - control = Bonobo_PropertyControl_getControl (dialog->p->property_control, 0, &ev); - - if (BONOBO_EX (&ev) || control == CORBA_OBJECT_NIL) { - bonobo_object_release_unref (dialog->p->property_control, NULL); - return FALSE; - } - - control_wid = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL); - - if (control_wid == NULL) { - bonobo_object_release_unref (dialog->p->property_control, NULL); - bonobo_object_release_unref (control, NULL); - return FALSE; - } - - for (i = 0; i < NUM_ROLLBACK_LEVELS - 1; i++) - get_modified_date (i, &(dialog->p->mod_dates[i])); - - moniker = get_moniker (dialog->p->capplet_moniker_name, NULL); - - cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_wid)); - dialog->p->control_pb = bonobo_control_frame_get_control_property_bag (cf, &ev); - bonobo_property_bag_client_set_value_string (dialog->p->control_pb, "moniker", moniker, &ev); - g_free (moniker); - - if (BONOBO_EX (&ev)) { - err_dialog = gnome_error_dialog ("Could not load your configuration settings."); - gnome_dialog_run_and_close (GNOME_DIALOG (err_dialog)); - bonobo_object_release_unref (dialog->p->property_control, NULL); - bonobo_object_release_unref (dialog->p->control_pb, NULL); - gtk_object_destroy (GTK_OBJECT (control_wid)); - return FALSE; - } - -/* gtk_widget_set_sensitive (control_wid, FALSE); */ - gtk_container_add (GTK_CONTAINER (dialog->p->control_socket), control_wid); - - gtk_widget_show_all (dialog->p->contents); - - CORBA_exception_free (&ev); - - return TRUE; -} - -static void -apply_settings (RollbackCappletDialog *dialog) -{ - ConfigArchiver_Archive archive; - ConfigArchiver_Location location; - CORBA_Environment ev; - xmlDocPtr doc; - - if (dialog->p->rollback_level == NUM_ROLLBACK_LEVELS - 1) - return; - - CORBA_exception_init (&ev); - - archive = bonobo_get_object ("archive:user-archive", "IDL:ConfigArchiver/Archive:1.0", &ev); - - if (BONOBO_EX (&ev) || archive == CORBA_OBJECT_NIL) { - g_critical ("Could not retrieve archive (%s)", ev._repo_id); - CORBA_exception_free (&ev); - return; - } - - location = ConfigArchiver_Archive__get_currentLocation (archive, &ev); - - if (BONOBO_EX (&ev) || location == CORBA_OBJECT_NIL) { - g_critical ("Could not retrieve current location (%s)", ev._repo_id); - bonobo_object_release_unref (archive, NULL); - CORBA_exception_free (&ev); - return; - } - - doc = location_client_load_rollback_data - (location, &(dialog->p->mod_dates[dialog->p->rollback_level]), 0, dialog->p->capplet_moniker_name, TRUE, &ev); - - if (BONOBO_EX (&ev) || doc == NULL) { - gchar *filename; - - filename = g_strconcat (GNOMECC_DEFAULTS_DIR "/", dialog->p->capplet_moniker_name, ".xml", NULL); - doc = xmlParseFile (filename); - g_free (filename); - - if (doc == NULL) { - g_critical ("Could not load rollback data (%s)", ev._repo_id); - bonobo_object_release_unref (location, NULL); - bonobo_object_release_unref (archive, NULL); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_init (&ev); - } - - location_client_store_xml - (location, dialog->p->capplet_moniker_name, doc, ConfigArchiver_STORE_MASK_PREVIOUS, &ev); - - if (BONOBO_EX (&ev) || doc == NULL) - g_critical ("Could not store rollback data (%s)", ev._repo_id); - - xmlFreeDoc (doc); - bonobo_object_release_unref (archive, NULL); - bonobo_object_release_unref (location, NULL); - - CORBA_exception_free (&ev); -} - -static gboolean -is_leap_year (guint year) -{ - if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) - return TRUE; - else - return FALSE; -} - -/* mod_date_by_str - * - * Modify the given date structure using the given time differential string - * encoding - */ - -static void -mod_date_by_str (struct tm *date, gint value, gchar unit) -{ - static const guint month_days[] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 - }; - - switch (unit) { - case 'm': - date->tm_min += value; - break; - case 'h': - date->tm_hour += value; - break; - case 'd': - date->tm_mday += value; - break; - case 'M': - date->tm_mon += value; - break; - case 'y': - date->tm_year += value; - break; - } - - if (date->tm_min < 0) { - date->tm_min = 59; - date->tm_hour--; - } - - if (date->tm_hour < 0) { - date->tm_hour = 23; - date->tm_mday--; - } - - if (date->tm_mday < 1) { - if (date->tm_mon == 2 && is_leap_year (date->tm_year)) - date->tm_mday = 29; - else - date->tm_mday = month_days[(date->tm_mon + 11) % 12]; - - date->tm_mon--; - } - - if (date->tm_mon < 0) { - date->tm_mon = 11; - date->tm_year--; - } -} - -static void -rollback_changed_cb (RollbackCappletDialog *dialog, - GtkAdjustment *adj) -{ - gchar *moniker; - - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - dialog->p->rollback_level = adj->value; - gtk_label_set_text (GTK_LABEL (dialog->p->label), labels[dialog->p->rollback_level]); - - if (dialog->p->rollback_level == NUM_ROLLBACK_LEVELS - 1) - moniker = get_moniker (dialog->p->capplet_moniker_name, NULL); - else - moniker = get_moniker (dialog->p->capplet_moniker_name, &(dialog->p->mod_dates[dialog->p->rollback_level])); - - bonobo_property_bag_client_set_value_string (dialog->p->control_pb, "moniker", moniker, &ev); - g_free (moniker); - - if (BONOBO_EX (&ev)) { - g_critical ("Could not load settings for rollback level %.0f (%s)", adj->value, ev._repo_id); - - if (adj->value != dialog->p->rollback_level) - gtk_adjustment_set_value (adj, dialog->p->rollback_level); - } else { - dialog->p->rollback_level = adj->value; - } - - CORBA_exception_free (&ev); -} - -static void -apply_cb (GtkButton *button, RollbackCappletDialog *dialog) -{ - apply_settings (dialog); -} - -static void -close_cb (GtkButton *button, RollbackCappletDialog *dialog) -{ - gnome_dialog_close (GNOME_DIALOG (dialog)); -} diff --git a/capplets/rollback/rollback-capplet-dialog.h b/capplets/rollback/rollback-capplet-dialog.h deleted file mode 100644 index 6202e648a..000000000 --- a/capplets/rollback/rollback-capplet-dialog.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-capplet-dialog.h - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifndef __ROLLBACK_CAPPLET_DIALOG_H -#define __ROLLBACK_CAPPLET_DIALOG_H - -#include - - -BEGIN_GNOME_DECLS - -#define ROLLBACK_CAPPLET_DIALOG(obj) GTK_CHECK_CAST (obj, rollback_capplet_dialog_get_type (), RollbackCappletDialog) -#define ROLLBACK_CAPPLET_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, rollback_capplet_dialog_get_type (), RollbackCappletDialogClass) -#define IS_ROLLBACK_CAPPLET_DIALOG(obj) GTK_CHECK_TYPE (obj, rollback_capplet_dialog_get_type ()) - -typedef struct _RollbackCappletDialog RollbackCappletDialog; -typedef struct _RollbackCappletDialogClass RollbackCappletDialogClass; -typedef struct _RollbackCappletDialogPrivate RollbackCappletDialogPrivate; - -struct _RollbackCappletDialog -{ - GnomeDialog parent; - - RollbackCappletDialogPrivate *p; -}; - -struct _RollbackCappletDialogClass -{ - GnomeDialogClass gnome_dialog_class; -}; - -GType rollback_capplet_dialog_get_type (void); - -GtkObject *rollback_capplet_dialog_new (gchar *capplet_name); - -END_GNOME_DECLS - -#endif /* __ROLLBACK_CAPPLET_DIALOG_H */ diff --git a/capplets/rollback/rollback-capplet.png b/capplets/rollback/rollback-capplet.png deleted file mode 100644 index 3621ea387..000000000 Binary files a/capplets/rollback/rollback-capplet.png and /dev/null differ diff --git a/capplets/rollback/rollback-control.c b/capplets/rollback/rollback-control.c deleted file mode 100644 index 9e0573afe..000000000 --- a/capplets/rollback/rollback-control.c +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-control.c - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include "rollback-control.h" -#include "rollback-widget.h" - -#define CONTROL_HEIGHT 30 -#define MARKER_SIZE 8 - -enum { - ARG_0, - ARG_CONTROL_NUMBER, - ARG_BACKEND_ID, - ARG_IS_GLOBAL -}; - -struct _RollbackControlPrivate -{ - Archive *archive; - Location *location; - ConfigLog *config_log; - gchar *backend_id; - gint y; /* y-coordonite of the canvas item */ - - GdkDrawable *drawable; -}; - -static GnomeCanvasItemClass *parent_class; - -static void rollback_control_init (RollbackControl *rollback_control); -static void rollback_control_class_init (RollbackControlClass *class); - -static void rollback_control_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void rollback_control_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); - -static void rollback_control_finalize (GtkObject *object); - -static void rollback_control_update (GnomeCanvasItem *item, - double affine[6], - ArtSVP *clip_path, - gint flags); -static void rollback_control_draw (GnomeCanvasItem *item, - GdkDrawable *drawable, - int x, int y, - int width, int height); - -static int draw_markers_cb (ConfigLog *config_log, - gint id, - gchar *backend_id, - struct tm *time, - RollbackControl *control); -static gint time_to_x (time_t t, gint width); -static gint horner (gint *coeff, gint degree, - gint divisor, gint x); - -GType -rollback_control_get_type (void) -{ - static GType rollback_control_type = 0; - - if (!rollback_control_type) { - GtkTypeInfo rollback_control_info = { - "RollbackControl", - sizeof (RollbackControl), - sizeof (RollbackControlClass), - (GtkClassInitFunc) rollback_control_class_init, - (GtkObjectInitFunc) rollback_control_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - rollback_control_type = - gtk_type_unique (gnome_canvas_item_get_type (), - &rollback_control_info); - } - - return rollback_control_type; -} - -static void -rollback_control_init (RollbackControl *rollback_control) -{ - rollback_control->p = g_new0 (RollbackControlPrivate, 1); -} - -static void -rollback_control_class_init (RollbackControlClass *class) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *canvas_item_class; - - gtk_object_add_arg_type ("RollbackControl::control-number", - GTK_TYPE_INT, - GTK_ARG_READWRITE, - ARG_CONTROL_NUMBER); - gtk_object_add_arg_type ("RollbackControl::backend-id", - GTK_TYPE_POINTER, - GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, - ARG_BACKEND_ID); - gtk_object_add_arg_type ("RollbackControl::is-global", - GTK_TYPE_INT, - GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY, - ARG_IS_GLOBAL); - - object_class = GTK_OBJECT_CLASS (class); - object_class->finalize = rollback_control_finalize; - object_class->set_arg = rollback_control_set_arg; - object_class->get_arg = rollback_control_get_arg; - - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (class); - canvas_item_class->update = rollback_control_update; - canvas_item_class->draw = rollback_control_draw; - - parent_class = GNOME_CANVAS_ITEM_CLASS - (gtk_type_class (gnome_canvas_item_get_type ())); -} - -static void -rollback_control_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackControl *rollback_control; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CONTROL (object)); - - rollback_control = ROLLBACK_CONTROL (object); - - switch (arg_id) { case ARG_CONTROL_NUMBER: - rollback_control->p->y = - GTK_VALUE_INT (*arg) * CONTROL_HEIGHT; - break; - - case ARG_BACKEND_ID: - g_return_if_fail (GTK_VALUE_POINTER (*arg) != NULL); - - rollback_control->p->backend_id = - g_strdup (GTK_VALUE_POINTER (*arg)); - break; - - case ARG_IS_GLOBAL: - if (GTK_VALUE_INT (*arg)) - rollback_control->p->archive = - ARCHIVE (archive_load (TRUE)); - else - rollback_control->p->archive = - ARCHIVE (archive_load (FALSE)); - - rollback_control->p->location = - archive_get_current_location - (rollback_control->p->archive); -/* rollback_control->p->config_log = */ -/* location_get_config_log */ -/* (rollback_control->p->location); */ - break; - - default: - g_warning ("Bad argument set"); - break; - } -} - -static void -rollback_control_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackControl *rollback_control; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CONTROL (object)); - - rollback_control = ROLLBACK_CONTROL (object); - - switch (arg_id) { - case ARG_CONTROL_NUMBER: - GTK_VALUE_INT (*arg) = rollback_control->p->y / CONTROL_HEIGHT; - break; - - case ARG_BACKEND_ID: - GTK_VALUE_POINTER (*arg) = rollback_control->p->backend_id; - break; - - case ARG_IS_GLOBAL: - GTK_VALUE_INT (*arg) = rollback_control->p->archive->is_global; - break; - - default: - g_warning ("Bad argument get"); - break; - } -} - -static void -rollback_control_finalize (GtkObject *object) -{ - RollbackControl *rollback_control; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_CONTROL (object)); - - rollback_control = ROLLBACK_CONTROL (object); - - g_free (rollback_control->p); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -rollback_control_update (GnomeCanvasItem *item, double affine[6], - ArtSVP *clip_path, gint flags) -{ - RollbackControl *control; - - g_return_if_fail (item != NULL); - g_return_if_fail (IS_ROLLBACK_CONTROL (item)); - - control = ROLLBACK_CONTROL (item); - - /* We don't support aa canvas for now */ - - if (item->canvas->aa) { - g_warning ("Anti-aliased canvas not supported for " - "this item"); - } else { - /* FIXME: Fix this */ - gnome_canvas_update_bbox (item, - 0, control->p->y, 65536, - control->p->y + CONTROL_HEIGHT); - } -} - -static void -rollback_control_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - RollbackWidget *widget; - RollbackControl *control; - GdkGC *gc; - - g_return_if_fail (item != NULL); - g_return_if_fail (IS_ROLLBACK_CONTROL (item)); - g_return_if_fail (IS_ROLLBACK_WIDGET (item->canvas)); - - control = ROLLBACK_CONTROL (item); - widget = ROLLBACK_WIDGET (item->canvas); - - gc = rollback_widget_get_gc (widget); - control->p->drawable = drawable; - - /* Render the background color */ - gdk_gc_set_foreground (gc, &widget->control_colors[BACKGROUND_COLOR]); - gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height); - - /* Render the markers */ - gdk_gc_set_foreground (gc, &widget->control_colors[MARKER_COLOR]); - config_log_iterate (control->p->config_log, - (ConfigLogIteratorCB) draw_markers_cb, control); -} - -static int -draw_markers_cb (ConfigLog *config_log, gint id, gchar *backend_id, - struct tm *time, RollbackControl *control) -{ - RollbackWidget *widget; - GdkGC *gc; - gint x; - - if (strcmp (backend_id, control->p->backend_id)) return 0; - - widget = ROLLBACK_WIDGET (GNOME_CANVAS_ITEM (control)->canvas); - gc = rollback_widget_get_gc (widget); - - /* FIXME: Get the width correctly */ - x = time_to_x (mktime (time), 300); - - gdk_draw_arc (control->p->drawable, gc, TRUE, x, - control->p->y + (CONTROL_HEIGHT - MARKER_SIZE) / 2, - MARKER_SIZE, MARKER_SIZE, 0, 360 * 64); - - return 0; -} - -/* I think I'm going to fake this over the rationals here by getting the lcm - * of all the denominators and dividing the result by that in the end. That - * might make my life less painful. - */ - -static gint -time_to_x (time_t t, gint width) -{ - gint coeff[5]; /* We have five points, so we use a degree-4 - * polynomial */ - time_t now; - - now = time (NULL); - - /* FIXME: Find out the real coefficients to use here */ - coeff[0] = 1; - coeff[1] = 2; - coeff[2] = 2; - coeff[3] = 5; - coeff[4] = 6; - - return width - width * (now - t) / (7 * 24 * 60 * 60); -/* return width - horner (coeff, 1, 4, now - t) * width; */ -} - -/* Treat the array coeff as the coefficient vector of a polynomial over the - * ring of integers and evaluate that polynomial at the given integer x, - * dividing at each step by the given divisor - */ - -static gint -horner (gint *coeff, gint divisor, gint degree, gint x) -{ - gint total = 0, i; - - for (i = 0; i <= degree; i++) - total = (total * x + coeff[i]) / divisor; - - return total; -} diff --git a/capplets/rollback/rollback-control.h b/capplets/rollback/rollback-control.h deleted file mode 100644 index dda28b590..000000000 --- a/capplets/rollback/rollback-control.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-control.h - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifndef __ROLLBACK_CONTROL_H -#define __ROLLBACK_CONTROL_H - -#include - - -BEGIN_GNOME_DECLS - -#define ROLLBACK_CONTROL(obj) GTK_CHECK_CAST (obj, rollback_control_get_type (), RollbackControl) -#define ROLLBACK_CONTROL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, rollback_control_get_type (), RollbackControlClass) -#define IS_ROLLBACK_CONTROL(obj) GTK_CHECK_TYPE (obj, rollback_control_get_type ()) - -typedef struct _RollbackControl RollbackControl; -typedef struct _RollbackControlClass RollbackControlClass; -typedef struct _RollbackControlPrivate RollbackControlPrivate; - -struct _RollbackControl -{ - GnomeCanvasItem parent; - - RollbackControlPrivate *p; -}; - -struct _RollbackControlClass -{ - GnomeCanvasItemClass gnome_canvas_item_class; -}; - -GType rollback_control_get_type (void); - -END_GNOME_DECLS - -#endif /* __ROLLBACK_CONTROL_H */ diff --git a/capplets/rollback/rollback-widget.c b/capplets/rollback/rollback-widget.c deleted file mode 100644 index d86a6f606..000000000 --- a/capplets/rollback/rollback-widget.c +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-widget.c - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "rollback-widget.h" - -enum { - ARG_0, - ARG_SAMPLE -}; - -struct _RollbackWidgetPrivate -{ - GdkGC *main_gc; -}; - -static GnomeCanvasClass *parent_class; - -static void rollback_widget_init (RollbackWidget *rollback_widget); -static void rollback_widget_class_init (RollbackWidgetClass *class); - -static void rollback_widget_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void rollback_widget_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); - -static void rollback_widget_finalize (GtkObject *object); - -static void rollback_widget_realize (GtkWidget *widget); -static void rollback_widget_unrealize (GtkWidget *widget); - -GType -rollback_widget_get_type (void) -{ - static GType rollback_widget_type = 0; - - if (!rollback_widget_type) { - GtkTypeInfo rollback_widget_info = { - "RollbackWidget", - sizeof (RollbackWidget), - sizeof (RollbackWidgetClass), - (GtkClassInitFunc) rollback_widget_class_init, - (GtkObjectInitFunc) rollback_widget_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - rollback_widget_type = - gtk_type_unique (gnome_canvas_get_type (), - &rollback_widget_info); - } - - return rollback_widget_type; -} - -static void -rollback_widget_init (RollbackWidget *rollback_widget) -{ - rollback_widget->p = g_new0 (RollbackWidgetPrivate, 1); - gtk_widget_set_usize (GTK_WIDGET (rollback_widget), 200, 30); - - rollback_widget->control_colors[BACKGROUND_COLOR].red = 112 * 256; - rollback_widget->control_colors[BACKGROUND_COLOR].green = 128 * 256; - rollback_widget->control_colors[BACKGROUND_COLOR].blue = 144 * 256; - - rollback_widget->control_colors[MARKER_COLOR].red = 0; - rollback_widget->control_colors[MARKER_COLOR].green = 0; - rollback_widget->control_colors[MARKER_COLOR].blue = 0; -} - -static void -rollback_widget_class_init (RollbackWidgetClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - gtk_object_add_arg_type ("RollbackWidget::sample", - GTK_TYPE_POINTER, - GTK_ARG_READWRITE, - ARG_SAMPLE); - - object_class = GTK_OBJECT_CLASS (class); - object_class->finalize = rollback_widget_finalize; - object_class->set_arg = rollback_widget_set_arg; - object_class->get_arg = rollback_widget_get_arg; - - widget_class = GTK_WIDGET_CLASS (class); - widget_class->realize = rollback_widget_realize; - widget_class->unrealize = rollback_widget_unrealize; - - parent_class = GNOME_CANVAS_CLASS - (gtk_type_class (gnome_canvas_get_type ())); -} - -static void -rollback_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackWidget *rollback_widget; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_WIDGET (object)); - - rollback_widget = ROLLBACK_WIDGET (object); - - switch (arg_id) { - case ARG_SAMPLE: - break; - - default: - g_warning ("Bad argument set"); - break; - } -} - -static void -rollback_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - RollbackWidget *rollback_widget; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_WIDGET (object)); - - rollback_widget = ROLLBACK_WIDGET (object); - - switch (arg_id) { - case ARG_SAMPLE: - break; - - default: - g_warning ("Bad argument get"); - break; - } -} - -static void -rollback_widget_finalize (GtkObject *object) -{ - RollbackWidget *rollback_widget; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ROLLBACK_WIDGET (object)); - - rollback_widget = ROLLBACK_WIDGET (object); - - g_free (rollback_widget->p); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - -GtkObject * -rollback_widget_new (void) -{ - return gtk_object_new (rollback_widget_get_type (), - NULL); -} - -GdkGC * -rollback_widget_get_gc (RollbackWidget *widget) -{ - g_return_val_if_fail (widget != NULL, NULL); - g_return_val_if_fail (IS_ROLLBACK_WIDGET (widget), NULL); - - gdk_gc_ref (widget->p->main_gc); - return widget->p->main_gc; -} - -static void -rollback_widget_realize (GtkWidget *widget) -{ - RollbackWidget *rollback_widget; - GdkColormap *colormap; - gboolean success[LAST_COLOR]; - gint i; - - rollback_widget = ROLLBACK_WIDGET (widget); - - if (!GTK_WIDGET_REALIZED (widget)) { - GTK_WIDGET_CLASS (parent_class)->realize (widget); - rollback_widget->p->main_gc = gdk_gc_new (widget->window); - - colormap = gtk_widget_get_colormap (widget); - gdk_colormap_alloc_colors (colormap, - rollback_widget->control_colors, - LAST_COLOR, FALSE, TRUE, - success); - - for (i = 0; success[i] && i < LAST_COLOR; i++); - - if (i < LAST_COLOR) - g_warning ("Could not allocate colors for rollback " - "control\n"); - } -} - -static void -rollback_widget_unrealize (GtkWidget *widget) -{ - if (ROLLBACK_WIDGET (widget)->p->main_gc != NULL) { - gdk_gc_unref (ROLLBACK_WIDGET (widget)->p->main_gc); - ROLLBACK_WIDGET (widget)->p->main_gc = NULL; - } - - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); -} diff --git a/capplets/rollback/rollback-widget.h b/capplets/rollback/rollback-widget.h deleted file mode 100644 index 7e901dc3a..000000000 --- a/capplets/rollback/rollback-widget.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- mode: c; style: linux -*- */ - -/* rollback-widget.h - * Copyright (C) 2000 Helix Code, Inc. - * - * Written by Bradford Hovinen - * - * 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, 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. - */ - -#ifndef __ROLLBACK_WIDGET_H -#define __ROLLBACK_WIDGET_H - -#include - - -BEGIN_GNOME_DECLS - -#define ROLLBACK_WIDGET(obj) GTK_CHECK_CAST (obj, rollback_widget_get_type (), RollbackWidget) -#define ROLLBACK_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, rollback_widget_get_type (), RollbackWidgetClass) -#define IS_ROLLBACK_WIDGET(obj) GTK_CHECK_TYPE (obj, rollback_widget_get_type ()) - -typedef struct _RollbackWidget RollbackWidget; -typedef struct _RollbackWidgetClass RollbackWidgetClass; -typedef struct _RollbackWidgetPrivate RollbackWidgetPrivate; - -enum { - BACKGROUND_COLOR, - MARKER_COLOR, - ARROW_COLOR, - LAST_COLOR -}; - -struct _RollbackWidget -{ - GnomeCanvas parent; - - RollbackWidgetPrivate *p; - - GdkColor control_colors[LAST_COLOR]; -}; - -struct _RollbackWidgetClass -{ - GnomeCanvasClass gnome_canvas_class; -}; - -GType rollback_widget_get_type (void); - -GtkObject *rollback_widget_new (void); - -GdkGC *rollback_widget_get_gc (RollbackWidget *widget); - -END_GNOME_DECLS - -#endif /* __ROLLBACK_WIDGET_H */ diff --git a/capplets/rollback/rollback.desktop.in.in b/capplets/rollback/rollback.desktop.in.in deleted file mode 100644 index 71d05b42b..000000000 --- a/capplets/rollback/rollback.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=Rollback -_Comment=Restore earlier configuration -Exec=rollback-capplet -Icon=rollback-capplet.png -Terminal=0 -Type=Application diff --git a/capplets/rollback/rollback.glade b/capplets/rollback/rollback.glade deleted file mode 100644 index 1b5d14969..000000000 --- a/capplets/rollback/rollback.glade +++ /dev/null @@ -1,872 +0,0 @@ - - - - - Rollback-location-management - rollback-location-management - - src - pixmaps - C - True - True - - - - GnomeDialog - rollback_location_dialog - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkNotebook - notebook1 - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - - - - GtkTable - table1 - 5 - 4 - 2 - False - 5 - 5 - - - GtkRadioButton - rollback_all_toggle - True - - toggled - rollback_all_toggled_cb - Tue, 19 Dec 2000 20:58:48 GMT - - - False - True - restore_type - - 0 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkButton - button4 - True - - GTK_RELIEF_NORMAL - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkButton - button5 - True - - GTK_RELIEF_NORMAL - - 1 - 2 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHBox - hbox2 - False - 0 - - 0 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkRadioButton - rollback_one_toggle - True - - toggled - rollback_one_toggled_cb - Tue, 19 Dec 2000 20:58:59 GMT - - - False - True - restore_type - - 0 - False - False - - - - - GtkOptionMenu - backend_select - True - - 0 - - 0 - True - True - - - - - - GtkHBox - hbox1 - False - 5 - - 0 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkSpinButton - time_count - True - - changed - time_count_changed_cb - Tue, 19 Dec 2000 20:15:27 GMT - - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 - 0 - 1000 - 1 - 10 - 10 - - 0 - False - True - - - - - GtkLabel - label4 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - - GtkLabel - Notebook:tab - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkHBox - location_tree_box - 5 - False - 5 - - - GtkVBox - vbox1 - False - 5 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - create_button - True - - clicked - create_cb - Wed, 20 Dec 2000 23:51:41 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - destroy_button - True - - clicked - destroy_cb - Wed, 20 Dec 2000 23:51:56 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - rename_button - True - - clicked - rename_cb - Wed, 20 Dec 2000 23:52:13 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkHSeparator - hseparator1 - - 0 - False - True - - - - - GtkButton - change_location_button - True - - clicked - change_location_cb - Wed, 20 Dec 2000 23:52:33 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - edit_button - True - - clicked - edit_location_cb - Wed, 20 Dec 2000 23:52:51 GMT - - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - - GtkScrolledWindow - location_tree_location - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - GTK_PACK_END - - - - Placeholder - - - - - - GtkLabel - Notebook:tab - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GnomeDialog - rollback_dialog_backup - Restore old configuration - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox3 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area3 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button14 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button15 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button16 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - config_dialog_data - False - 5 - - 0 - True - True - - - - GtkHBox - hbox4 - False - 5 - - 0 - True - True - - - - GtkLabel - label10 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkSpinButton - spinbutton1 - True - - changed - time_count_changed_cb - Tue, 19 Dec 2000 20:15:27 GMT - - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 - 0 - 1000 - 1 - 10 - 10 - - 0 - False - True - - - - - GtkLabel - label11 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - GtkTable - table2 - 2 - 2 - False - 5 - 0 - - 0 - True - True - - - - GtkRadioButton - rollback_all_toggle - True - - toggled - rollback_all_toggled_cb - Tue, 19 Dec 2000 20:58:48 GMT - - - False - True - restore_type - - 0 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkRadioButton - rollback_one_toggle - True - - toggled - rollback_one_toggled_cb - Tue, 19 Dec 2000 20:58:59 GMT - - - False - True - restore_type - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkOptionMenu - backend_select - True - - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - True - - - - - - - - - GnomeDialog - rollback_dialog_win - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox4 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area4 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button17 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button18 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button19 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - rollback_dialog - False - 5 - - 0 - True - True - - - - GtkLabel - rollback_level_label - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkHScale - rollback_scale - True - False - GTK_POS_TOP - 0 - GTK_UPDATE_DISCONTINUOUS - 0 - 0 - 0 - 0 - 0 - 0 - - 0 - True - True - - - - - GtkFrame - control_socket - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - Placeholder - - - - - - - diff --git a/capplets/url-properties/ChangeLog b/capplets/url-properties/ChangeLog deleted file mode 100644 index 46b684cb8..000000000 --- a/capplets/url-properties/ChangeLog +++ /dev/null @@ -1,163 +0,0 @@ -2004-10-14 Jody Goldberg - - * Release 2.8.1 - -2004-04-15 Jody Goldberg - - * Release 2.6.1 - -2004-04-01 Jody Goldberg - - * Release 2.6.0.3 - -2004-03-30 Jody Goldberg - - * Release 2.6.0.1 - -2004-03-23 Jody Goldberg - - * Release 2.6.0 - -2004-03-11 Jody Goldberg - - * Release 2.5.4 - -2004-02-13 Jody Goldberg - - * Release 2.5.3 - -2004-02-08 Kjartan Maraas - - * url-properties.c: Replace deprecated call to g_basename. - (#133174, Kjartan Maraas) - -2004-01-14 Jody Goldberg - - * Release 2.5.2 - -2003-12-30 Jody Goldberg - - * Release 2.5.1.1 - -2003-12-30 Jody Goldberg - - * Release 2.5.1 - -2003-10-28 Jody Goldberg - - * Release 2.5.0 - -2003-07-07 Jody Goldberg - - * Release 2.3.4 - -2003-06-24 Jody Goldberg - - * Release 2.3.3 - -2003-05-07 Jody Goldberg - - * Release 2.3.1 - -Tue Feb 4 17:09:18 2003 Jonathan Blandford - - * Release 2.2.0.1 - -Tue Jan 21 01:15:14 2003 Jonathan Blandford - - * Release 2.2.0 - -Thu Jan 16 02:41:09 2003 Jonathan Blandford - - * Release 2.1.7 - -2003-01-10 Jody Goldberg - - * Release 2.1.6 - -2002-12-18 Jody Goldberg - - * Release 2.1.5 - -2002-11-23 Jody Goldberg - - * Release 2.1.3 - -2002-11-02 Jody Goldberg - - * Release 2.1.2 - -2002-10-21 Jody Goldberg - - * Release 2.1.1 - -2002-10-01 Jody Goldberg - - * Release 2.1.0.1 - -2002-08-21 Jody Goldberg - - * Release 2.1.0 - -2002-06-17 Jody Goldberg - - * Release 2.0.0 - -2001-12-08 Richard Hestilow - - * url-properties.c: Port to GConf. - -2001-10-17 Bradford Hovinen - - * url-properties.c: Make sure the row is unselected before trying - to remove it - -2001-10-16 Jakub Steiner - - * url-capplet.png: changed the icon based on usability@ notes - -2001-07-27 Bradford Hovinen - - * RELEASE : 1.5.2 - -2001-07-24 Chema Celorio - - * url-properties.c: set the usize of the window - -2001-07-20 Chema Celorio - - * RELEASE : 1.5.0 - -1999-06-11 Ettore Perazzoli - - * url-properties.c (main): Exit with an error if - `gnome_capplet_init()' returns an error. Bug reported by Nicola - Pero . - -1999-05-16 Jacob Berkman - - * url-properties.c (url_capplet_commit): added a - gnome_config_sync() so the changes actually get saved. - (gnome bug #169) - -1998-12-12 Nuno Ferreira - - * url-properties.c: Change included "config.h" to . - - * url-properties.desktop: Added Portuguese translation. - -1998-12-11 Nuno Ferreira - - * .cvsignore: Added this file. - -1998-12-08 James Henstridge - * url-properties.c: forgot the copyright message at the top of the - file. - -1998-12-08 James Henstridge - - * url-properties.c, url-properties.desktop, Makefile.am: A new capplet - that can be used to configure the behaviour of the gnome_url_show - function. - - diff --git a/capplets/url-properties/Makefile.am b/capplets/url-properties/Makefile.am deleted file mode 100644 index cdc4c4703..000000000 --- a/capplets/url-properties/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -cappletname = url -cappletgroup = "Advanced/" -bin_PROGRAMS = url-properties - -url_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) -url_properties_SOURCES = url-properties.c - -pixmap_DATA = - -## -## You should not need to modify anything below this line -## -@INTLTOOL_DESKTOP_RULE@ -@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@ - -INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) -CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) -EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) -iconsdir = $(pkgdatadir)/icons -Gladedir = $(pkgdatadir)/glade -pixmapdir = $(pkgdatadir)/pixmaps -Glade_DATA = $(cappletname)-properties.glade -icons_DATA = $(cappletname)-capplet.png -desktop = $(cappletname).desktop -all-local: $(desktop) diff --git a/capplets/url-properties/url-capplet.png b/capplets/url-properties/url-capplet.png deleted file mode 100644 index 461526625..000000000 Binary files a/capplets/url-properties/url-capplet.png and /dev/null differ diff --git a/capplets/url-properties/url-properties.c b/capplets/url-properties/url-properties.c deleted file mode 100644 index 2827a75af..000000000 --- a/capplets/url-properties/url-properties.c +++ /dev/null @@ -1,309 +0,0 @@ -/* url-properties -- a capplet to configure the behaviour of gnome_url_show - * Copyright (C) 1998 James Henstridge - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -GtkWidget *capplet, *protocol, *combo, *clist; -GSList *handlers_removed = NULL; - -void url_capplet_refill_clist (void); -void url_capplet_commit(void); - -void build_capplet(void); -void state_changed (void); -void response_cb (GtkDialog *dialog, GtkResponseType response, gpointer data); -void set_handler(GtkEntry *entry); -void remove_handler(GtkButton *button); -void select_clist_row(GtkCList *clist, gint row, gint column); - -int -main(int argc, char *argv[]) { - gint init_ret; - - bindtextdomain(PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (PACKAGE, "UTF-8"); - textdomain(PACKAGE); - - gnome_program_init ("url-properties", VERSION, - LIBGNOMEUI_MODULE, argc, argv, NULL); - - build_capplet(); - url_capplet_refill_clist (); /* this will refill the clist */ - - gtk_signal_connect(GTK_OBJECT(capplet), "response", - GTK_SIGNAL_FUNC(response_cb), NULL); - - gtk_main(); - return 0; -} - -void build_capplet(void) { - GtkWidget *vbox, *hbox, *item, *button; - gchar *titles[] = { N_("Protocol"), N_("Command") }; - - capplet = gtk_dialog_new_with_buttons (_("URL Handlers"), NULL, - -1, - GTK_STOCK_HELP, GTK_RESPONSE_HELP, - GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL); - gtk_dialog_set_response_sensitive (GTK_DIALOG (capplet), GTK_RESPONSE_APPLY, - FALSE); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_widget_set_usize (vbox, 400, 250); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (capplet)->vbox), vbox, TRUE, TRUE, 0); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - gtk_widget_show(hbox); - - protocol = gtk_entry_new(); - gtk_widget_set_usize(protocol, 80, -1); - gtk_box_pack_start(GTK_BOX(hbox), protocol, FALSE, TRUE, 0); - gtk_widget_show(protocol); - - item = gtk_label_new(_("handler:")); - gtk_box_pack_start(GTK_BOX(hbox), item, FALSE, TRUE, 0); - gtk_widget_show(item); - - combo = gtk_combo_new(); - gtk_combo_set_use_arrows(GTK_COMBO(combo), FALSE); - gtk_combo_set_value_in_list(GTK_COMBO(combo), FALSE, FALSE); - gtk_combo_disable_activate(GTK_COMBO(combo)); - - /* set some commonly used handlers */ - item = gtk_list_item_new_with_label(_("Netscape")); - gtk_combo_set_item_string(GTK_COMBO(combo), GTK_ITEM(item), - "gnome-moz-remote '%s'"); - gtk_container_add(GTK_CONTAINER(GTK_COMBO(combo)->list), item); - gtk_widget_show(item); - item = gtk_list_item_new_with_label(_("Netscape (new window)")); - gtk_combo_set_item_string(GTK_COMBO(combo), GTK_ITEM(item), - "gnome-moz-remote --newwin '%s'"); - gtk_container_add(GTK_CONTAINER(GTK_COMBO(combo)->list), item); - gtk_widget_show(item); - - item = gtk_list_item_new_with_label(_("Help browser")); - gtk_combo_set_item_string(GTK_COMBO(combo), GTK_ITEM(item), - "gnome-help-browser '#%s'"); - gtk_container_add(GTK_CONTAINER(GTK_COMBO(combo)->list), item); - gtk_widget_show(item); - item = gtk_list_item_new_with_label(_("Help browser (new window)")); - gtk_combo_set_item_string(GTK_COMBO(combo), GTK_ITEM(item), - "gnome-help-browser '%s'"); - gtk_container_add(GTK_CONTAINER(GTK_COMBO(combo)->list), item); - gtk_widget_show(item); - - gtk_box_pack_start(GTK_BOX(hbox), combo, TRUE, TRUE, 0); - gtk_widget_show(combo); - - gtk_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->entry), "activate", - GTK_SIGNAL_FUNC(set_handler), NULL); - - button = gtk_button_new_with_label(_("Set")); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); - gtk_widget_show(button); - - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(set_handler), - GTK_OBJECT(GTK_COMBO(combo)->entry)); - - button = gtk_button_new_with_label(_("Remove")); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); - gtk_widget_show(button); - - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(remove_handler), NULL); - - item = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(item), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(vbox), item, TRUE, TRUE, 0); - gtk_widget_show(item); - - titles[0] = _(titles[0]); - titles[1] = _(titles[1]); - clist = gtk_clist_new_with_titles(2, titles); - gtk_container_add(GTK_CONTAINER(item), clist); - gtk_widget_show(clist); - - gtk_clist_set_column_width(GTK_CLIST(clist), 0, 50); - gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE); - gtk_clist_set_sort_type(GTK_CLIST(clist), GTK_SORT_ASCENDING); - gtk_clist_set_sort_column(GTK_CLIST(clist), 0); - gtk_clist_set_auto_sort(GTK_CLIST(clist), TRUE); - - gtk_signal_connect(GTK_OBJECT(clist), "select_row", - GTK_SIGNAL_FUNC(select_clist_row), NULL); - - gtk_widget_show(capplet); -} - -void url_capplet_refill_clist(void) { - GSList *l; - GConfClient *client; - - gtk_clist_freeze(GTK_CLIST(clist)); - gtk_clist_clear(GTK_CLIST(clist)); - - client = gconf_client_get_default (); - l = gconf_client_all_entries (client, "/desktop/gnome/url-handlers", NULL); - for (; l != NULL; l = l->next) - { - GConfEntry *e = l->data; - gchar *key = g_strdup (e->key); - gchar *value = g_strdup (gconf_value_get_string (gconf_entry_get_value (e))); - gchar *filename = g_path_get_basename (key); - int len = strlen(key); - - if (len > 5 && !strcmp(&key[len-5], "-show")) { - gchar *row[2]; - gint id; - /* it is a *-show key */ - key[len-5] = '\0'; - row[0] = filename; - row[1] = value; - - id = gtk_clist_append(GTK_CLIST(clist), row); - if (!g_strcasecmp(key, "default")) - gtk_clist_select_row(GTK_CLIST(clist), id, 0); - } - g_free(key); - g_free(value); - g_free(filename); - gconf_entry_free (e); - } - gtk_clist_thaw(GTK_CLIST(clist)); - - g_slist_free (l); - g_object_unref (G_OBJECT (client)); -} - -void url_capplet_commit(void) { - gint num_rows, row; - gchar *col1, *col2, *key; - gchar *prefix = "/desktop/gnome/url-handlers/"; - GConfClient *client = gconf_client_get_default (); - GSList *l; - - for (l = handlers_removed; l != NULL; l = l->next) - { - key = g_strconcat (prefix, l->data, "-show", NULL); - gconf_client_unset (client, key, NULL); - g_free (key); - g_free (l->data); - } - - g_slist_free (handlers_removed); - handlers_removed = NULL; - - num_rows = GTK_CLIST(clist)->rows; - for (row = 0; row < num_rows; row++) { - gtk_clist_get_text(GTK_CLIST(clist), row, 0, &col1); - gtk_clist_get_text(GTK_CLIST(clist), row, 1, &col2); - key = g_strconcat (prefix, col1, "-show", NULL); - gconf_client_set_string (client, key, col2, NULL); - g_free(key); - } - - g_object_unref (G_OBJECT (client)); -} - -void set_handler(GtkEntry *entry) { - gint row, num_rows; - gchar *col1, *prot, *cols[2]; - - num_rows = GTK_CLIST(clist)->rows; - prot = gtk_entry_get_text(GTK_ENTRY(protocol)); - for (row = 0; row < num_rows; row++) { - gtk_clist_get_text(GTK_CLIST(clist), row, 0, &col1); - if (!g_strcasecmp(prot, col1)) { - gtk_clist_set_text(GTK_CLIST(clist), row, 1, gtk_entry_get_text(entry)); - state_changed (); - return; - } - } - /* prot not in clist */ - cols[0] = prot; - cols[1] = gtk_entry_get_text(entry); - gtk_clist_append(GTK_CLIST(clist), cols); - state_changed (); -} - -void remove_handler(GtkButton *button) { - gint row, num_rows; - gchar *col1, *prot; - - num_rows = GTK_CLIST(clist)->rows; - prot = gtk_entry_get_text(GTK_ENTRY(protocol)); - for (row = 0; row < num_rows; row++) { - gtk_clist_get_text(GTK_CLIST(clist), row, 0, &col1); - if (!g_strcasecmp(prot, col1)) { - handlers_removed = g_slist_prepend (handlers_removed, g_strdup (col1)); - gtk_clist_unselect_row(GTK_CLIST(clist), row, 0); - gtk_clist_remove(GTK_CLIST(clist), row); - state_changed (); - gtk_entry_set_text(GTK_ENTRY(protocol), ""); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), ""); - if (num_rows > 1) - gtk_clist_select_row(GTK_CLIST(clist), 0, 0); - return; - } - } -} - -void select_clist_row(GtkCList *clist, gint row, gint column) { - gchar *col1, *col2; - - /* get column values */ - gtk_clist_get_text(GTK_CLIST(clist), row, 0, &col1); - gtk_clist_get_text(GTK_CLIST(clist), row, 1, &col2); - - gtk_entry_set_text(GTK_ENTRY(protocol), col1); - - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), col2); -} - -void state_changed (void) -{ - gtk_dialog_set_response_sensitive (GTK_DIALOG (capplet), GTK_RESPONSE_APPLY, - TRUE); -} - -void response_cb (GtkDialog *dialog, GtkResponseType response, gpointer data) -{ - switch (response) - { - case GTK_RESPONSE_NONE: - case GTK_RESPONSE_CLOSE: - gtk_main_quit (); - break; - case GTK_RESPONSE_APPLY: - url_capplet_commit (); - break; - } -} diff --git a/capplets/url-properties/url-properties.desktop.in.in b/capplets/url-properties/url-properties.desktop.in.in deleted file mode 100644 index 56d016931..000000000 --- a/capplets/url-properties/url-properties.desktop.in.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -_Name=URL Handlers -_Comment=Configure which programs are used to display URLs -Exec=url-properties -Icon=gnome-html.png -Terminal=0 -Type=Application -StartupNotify=true -X-GNOME-Bugzilla-Bugzilla=GNOME -X-GNOME-Bugzilla-Product=control-center -X-GNOME-Bugzilla-Component=other-capplets -X-GNOME-Bugzilla-Version=@VERSION@ diff --git a/capplets/url-properties/url-properties.glade b/capplets/url-properties/url-properties.glade deleted file mode 100644 index e69de29bb..000000000 diff --git a/capplets/url-properties/url-properties_WITH_TRANSLATIONS b/capplets/url-properties/url-properties_WITH_TRANSLATIONS deleted file mode 100644 index dfa336363..000000000 --- a/capplets/url-properties/url-properties_WITH_TRANSLATIONS +++ /dev/null @@ -1,57 +0,0 @@ -[Desktop Entry] -Name=URL Handlers -Name[pt_BR]=Manipuladores de URL -Name[cs]=Obsluha URL -Name[ca]=Gestors d'URLs -Name[da]=Url-håndterer -Name[de]=Öffnen von URLs -Name[el]=ÖõëëïìÝôñçóç URL -Name[es]=Navegador de URLs -Name[et]=URL käsitlejad -Name[fi]=URL-käsittely -Name[fr]=Gestionnaires d'URLs -Name[gl]=Xestores de URL -Name[hu]=URL kezelõk -Name[it]=Gestori URL -Name[ja]=URL¥Ï¥ó¥É¥é -Name[ko]=URL ó¸® -Name[no]=URL-håndtering -Name[pl]=Obs³uga URL -Name[pt]=URL Handlers -Name[ro]=Tratare URL-uri -Name[ru]=ïÂÒÁÂÏÔÞÉËÉ URL -Name[sl]=URL Upravniki -Name[sv]=URL-hantering -Name[tr]=URL yöneticileri -Name[uk]=ïÂÒÏÂÎÉËÉ URL -Name[wa]=Naivieu di hårdeyes (URLs) -Comment=Configure which programs are used to display URLs -Comment[pt_BR]=Configurar que programas são usados para mostrar URLs. -Comment[cs]=Nastavení programù pro zobrazení URL -Comment[ca]=Seleccionar quins programes usar per mostrar URLs. -Comment[da]=Vælg hvilke programmer der skal bruges til at åbne url'er -Comment[de]=Konfigurieren, womit URLs geöffnet werden -Comment[el]=Ñõèìßæåé ðïéÜ ðñïãñÜììáôá èá äåß÷íïõí ôá URL -Comment[es]=Configura cual programa usar para navegar por las URLs -Comment[et]=Määrab, millised programmid käsitlevad milliseid URL protokolle -Comment[fi]=Aseta, mitä ohjelmia käytetään URL:ien näyttämiseen -Comment[fr]=Configuration des applications utilisées pour afficher les URLs -Comment[gl]=Configura os programas que se van usar para amosar as URL -Comment[hu]=A külömbözõ webhelyek-dokumentumok kezelésének beállítása -Comment[it]=Impostazione dei programmi necessari per visualizzare le URL -Comment[ja]=URL¤òɽ¼¨¤¹¤ë¥×¥í¥°¥é¥à¤ÎÀßÄê -Comment[ko]=URLÀ» Ç¥½ÃÇÒ ¶§ »ç¿ëÇÒ ÇÁ·Î±×·¥ ¼±Åà -Comment[no]=Konfigurer hvilke programmer som brukes til å vise URL'er -Comment[pl]=Konfiguracja programów do obs³ugi URL-i -Comment[pt]=Permite configurar quais os programas usados para mostrar URLs -Comment[ro]=Configuraþi ce programe sunt folosite pentru URL-uri -Comment[ru]=ïÐÒÅÄÅÌÉÔØ ÐÒÏÇÒÁÍÍÕ ÄÌÑ ÐÏËÁÚÁ URL. -Comment[sl]=Nastavi kateri programi naj se uporabijo za prikazovanje URLjev -Comment[sv]=Konfigurera vilka program som används för att visa URL:er -Comment[tr]=URL'leri gösterecek uygulamalarý belirtir -Comment[uk]=÷ÉÚÎÁÞÅÎÎÑ ÐÒÏÇÒÁÍÉ ÄÌÑ ×¦ÄÏÂÒÁÖÅÎÎÑ URL -Comment[wa]=Tchwezixhoz li programe ki vos voloz po naivyî sol rantoele daegnrece et po vey les hårdeyes -Exec=url-properties -Icon=gnome-html.png -Terminal=0 -Type=Application diff --git a/capplets/url-properties/url.desktop.in.in b/capplets/url-properties/url.desktop.in.in deleted file mode 100644 index 41d585fc8..000000000 --- a/capplets/url-properties/url.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=URL Handlers -_Comment=Configure which programs are used to display URLs -Exec=url-properties -Icon=gnome-html.png -Terminal=0 -Type=Application diff --git a/capplets/wm-properties/wm-desktops/Enlightenment.desktop.in.in b/capplets/wm-properties/wm-desktops/Enlightenment.desktop.in.in deleted file mode 100644 index 1d9d0a199..000000000 --- a/capplets/wm-properties/wm-desktops/Enlightenment.desktop.in.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -_Name=Enlightenment -Exec=enlightenment -TryExec=enlightenment - -[Window Manager] -ConfigExec=e-conf -ConfigTryExec=e-conf -SessionManaged=true diff --git a/capplets/wm-properties/wm-desktops/IceWM.desktop.in.in b/capplets/wm-properties/wm-desktops/IceWM.desktop.in.in deleted file mode 100644 index e12d1a9c0..000000000 --- a/capplets/wm-properties/wm-desktops/IceWM.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=Ice WM -Exec=icewm -TryExec=icewm - -[Window Manager] -SessionManaged=true diff --git a/capplets/wm-properties/wm-desktops/Makefile.am b/capplets/wm-properties/wm-desktops/Makefile.am deleted file mode 100644 index 8621046a2..000000000 --- a/capplets/wm-properties/wm-desktops/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -wms = \ - Enlightenment \ - IceWM \ - Scwm \ - WindowMaker \ - twm - -desktop_files = $(wms:=.desktop) -desktop_in_files = $(desktop_files:.desktop=.desktop.in) -desktop_in_in_files = $(desktop_files:.desktop=.desktop.in.in) - -wmdatadir = $(datadir)/gnome/wm-properties -wmdata_DATA = $(desktop_files) - -EXTRA_DIST = $(desktop_in_in_files) - -$(desktop_in_files): %.desktop.in: %.desktop.in.in - sed s#Icon=#Icon=$(pkgdatadir)/icons/# < $< > $@ - -$(desktop_files): %.desktop: %.desktop.in - $(top_builddir)/intltool-merge -d $(top_srcdir)/po $< $@ diff --git a/capplets/wm-properties/wm-desktops/Scwm.desktop.in.in b/capplets/wm-properties/wm-desktops/Scwm.desktop.in.in deleted file mode 100644 index 88e0a8c30..000000000 --- a/capplets/wm-properties/wm-desktops/Scwm.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=Scwm -Exec=scwm -TryExec=scwm - -[Window Manager] -SessionManaged=true diff --git a/capplets/wm-properties/wm-desktops/WindowMaker.desktop.in.in b/capplets/wm-properties/wm-desktops/WindowMaker.desktop.in.in deleted file mode 100644 index 7e1cde50e..000000000 --- a/capplets/wm-properties/wm-desktops/WindowMaker.desktop.in.in +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -_Name=Window Maker -Exec=wmaker -TryExec=wmaker - -[Window Manager] -SessionManaged=false -ConfigExec=/usr/X11R6/lib/GNUstep/Apps/WPrefs.app/WPrefs diff --git a/capplets/wm-properties/wm-desktops/twm.desktop.in.in b/capplets/wm-properties/wm-desktops/twm.desktop.in.in deleted file mode 100644 index 45aef35a9..000000000 --- a/capplets/wm-properties/wm-desktops/twm.desktop.in.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -_Name=twm -Exec=twm -TryExec=twm - -[Window Manager] -SessionManaged=false