eel r2189 - in trunk: . eel
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: eel r2189 - in trunk: . eel
- Date: Tue, 7 Oct 2008 08:41:24 +0000 (UTC)
Author: alexl
Date: Tue Oct 7 08:41:24 2008
New Revision: 2189
URL: http://svn.gnome.org/viewvc/eel?rev=2189&view=rev
Log:
2008-10-07 Alexander Larsson <alexl redhat com>
* eel/eel-gnome-extensions.[ch]:
Remove gnome_icon_selector code
Modified:
trunk/ChangeLog
trunk/eel/eel-gnome-extensions.c
trunk/eel/eel-gnome-extensions.h
Modified: trunk/eel/eel-gnome-extensions.c
==============================================================================
--- trunk/eel/eel-gnome-extensions.c (original)
+++ trunk/eel/eel-gnome-extensions.c Tue Oct 7 08:41:24 2008
@@ -220,221 +220,6 @@
eel_gnome_open_terminal_on_screen (command, NULL);
}
-/* create a new icon selection dialog */
-static gboolean
-widget_destroy_callback (gpointer callback_data)
-{
- IconSelectionData *selection_data;
-
- selection_data = (IconSelectionData *) callback_data;
- gtk_widget_destroy (selection_data->dialog);
- g_free (selection_data);
- return FALSE;
-}
-
-/* set the image of the file object to the selected file */
-static void
-icon_selected (IconSelectionData *selection_data)
-{
- const char *icon_path;
- struct stat buf;
- GtkWidget *entry;
-
- gnome_icon_selection_stop_loading (GNOME_ICON_SELECTION (selection_data->icon_selection));
-
- /* Hide the dialog now, so the user can't press the buttons multiple
- times. */
- gtk_widget_hide (selection_data->dialog);
-
- /* If we've already acted on the dialog, just return. */
- if (selection_data->dismissed)
- return;
-
- /* Set the flag to indicate we've acted on the dialog and are about
- to destroy it. */
- selection_data->dismissed = TRUE;
-
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (selection_data->file_entry));
- icon_path = gtk_entry_get_text (GTK_ENTRY (entry));
-
- /* if a specific file wasn't selected, put up a dialog to tell the
- * user to pick something, and leave the picker up
- */
- stat (icon_path, &buf);
- if (S_ISDIR (buf.st_mode)) {
- eel_show_error_dialog (_("No image was selected."),
- _("You must click on an image to select it."),
- selection_data->owning_window);
- } else {
- /* invoke the callback to inform it of the file path */
- selection_data->selection_function (icon_path, selection_data->callback_data);
- }
-
- /* We have to get rid of the icon selection dialog, but we can't do it now, since the
- * file entry might still need it. Do it when the next idle rolls around
- */
- g_idle_add (widget_destroy_callback, selection_data);
-}
-
-/* handle the cancel button being pressed */
-static void
-icon_cancel_pressed (IconSelectionData *selection_data)
-{
- /* nothing to do if it's already been dismissed */
- if (selection_data->dismissed) {
- return;
- }
-
- gtk_widget_destroy (selection_data->dialog);
- g_free (selection_data);
-}
-
-/* handle an icon being selected by updating the file entry */
-static void
-list_icon_selected_callback (GnomeIconList *gil, int num, GdkEvent *event, IconSelectionData *selection_data)
-{
- char *icon;
- GtkWidget *entry;
-
- icon = gnome_icon_selection_get_icon (GNOME_ICON_SELECTION (selection_data->icon_selection), TRUE);
- if (icon != NULL) {
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (selection_data->file_entry));
- gtk_entry_set_text (GTK_ENTRY (entry), icon);
- g_free (icon);
- }
-
- /* handle double-clicks as if the user pressed OK */
- if (event != NULL && event->type == GDK_2BUTTON_PRESS && ((GdkEventButton *) event)->button == 1) {
- icon_selected (selection_data);
- }
-}
-
-static void
-dialog_response_callback (GtkWidget *dialog, int response_id, IconSelectionData *selection_data)
-{
- switch (response_id) {
- case GTK_RESPONSE_OK:
- icon_selected (selection_data);
- break;
- case GTK_RESPONSE_CANCEL:
- case GTK_RESPONSE_DELETE_EVENT:
- icon_cancel_pressed (selection_data);
- break;
- default:
- break;
- }
-}
-
-/* handle the file entry changing */
-static void
-entry_activated_callback (GtkWidget *widget, IconSelectionData *selection_data)
-{
- struct stat buf;
- GnomeIconSelection *icon_selection;
- const char *filename;
-
- filename = gtk_entry_get_text (GTK_ENTRY (widget));
- if (filename == NULL) {
- return;
- }
-
- if (stat (filename, &buf) == 0 && S_ISDIR (buf.st_mode)) {
- icon_selection = GNOME_ICON_SELECTION (selection_data->icon_selection);
- gnome_icon_selection_clear (icon_selection, TRUE);
- gnome_icon_selection_add_directory (icon_selection, filename);
- gnome_icon_selection_show_icons(icon_selection);
- } else {
- /* We pretend like ok has been called */
- icon_selected (selection_data);
- }
-}
-
-/* here's the actual routine that creates the icon selector.
- Note that this may return NULL if the dialog was destroyed before the
- icons were all loaded. GnomeIconSelection reenters the main loop while
- it loads the icons, so beware! */
-
-GtkWidget *
-eel_gnome_icon_selector_new (const char *title,
- const char *icon_directory,
- GtkWindow *owner,
- EelIconSelectionFunction selected,
- gpointer callback_data)
-{
- GtkWidget *dialog, *icon_selection, *retval;
- GtkWidget *entry, *file_entry;
- IconSelectionData *selection_data;
-
- dialog = gtk_dialog_new_with_buttons (title, owner, 0,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
-
- icon_selection = gnome_icon_selection_new ();
-
- file_entry = gnome_file_entry_new (NULL,NULL);
-
- g_object_set (G_OBJECT (file_entry), "use_filechooser", TRUE, NULL);
-
- selection_data = g_new0 (IconSelectionData, 1);
- selection_data->dialog = dialog;
- selection_data->icon_selection = icon_selection;
- selection_data->file_entry = file_entry;
- selection_data->owning_window = owner;
- selection_data->selection_function = selected;
- selection_data->callback_data = callback_data;
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- file_entry, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- icon_selection, TRUE, TRUE, 0);
-
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- if (owner != NULL) {
- gtk_window_set_transient_for (GTK_WINDOW (dialog), owner);
- }
- gtk_widget_show_all (dialog);
-
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (file_entry));
-
- if (icon_directory == NULL) {
- gtk_entry_set_text (GTK_ENTRY (entry), DATADIR "/pixmaps");
- gnome_icon_selection_add_directory (GNOME_ICON_SELECTION (icon_selection), DATADIR "/pixmaps");
- } else {
- gtk_entry_set_text (GTK_ENTRY (entry), icon_directory);
- gnome_icon_selection_add_directory (GNOME_ICON_SELECTION (icon_selection), icon_directory);
- }
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (dialog_response_callback), selection_data);
-
- g_signal_connect_after (gnome_icon_selection_get_gil (GNOME_ICON_SELECTION (selection_data->icon_selection)),
- "select_icon",
- G_CALLBACK (list_icon_selected_callback), selection_data);
-
- g_signal_connect (entry, "activate",
- G_CALLBACK (entry_activated_callback), selection_data);
-
- /* We add a weak pointer to the dialog, so we know if it has been
- destroyed while the icons are being loaded. */
- eel_add_weak_pointer (&dialog);
-
- gnome_icon_selection_show_icons (GNOME_ICON_SELECTION (icon_selection));
-
- /* eel_remove_weak_pointer() will set dialog to NULL, so we need to
- remember the dialog pointer here, if there is one. */
- retval = dialog;
-
- /* Now remove the weak pointer, if the dialog still exists. */
- eel_remove_weak_pointer (&dialog);
-
- return retval;
-}
-
-
/**
* eel_glade_get_file:
* @filename: the XML file name.
Modified: trunk/eel/eel-gnome-extensions.h
==============================================================================
--- trunk/eel/eel-gnome-extensions.h (original)
+++ trunk/eel/eel-gnome-extensions.h Tue Oct 7 08:41:24 2008
@@ -29,7 +29,6 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
-#include <bonobo/bonobo-property-bag-client.h>
/* icon selection callback function. */
typedef void (* EelIconSelectionFunction) (const char *icon_path, gpointer callback_data);
@@ -42,14 +41,7 @@
void eel_gnome_open_terminal (const char *command);
void eel_gnome_open_terminal_on_screen (const char *command,
GdkScreen *screen);
-
-/* Create an icon selection dialog */
-GtkWidget * eel_gnome_icon_selector_new (const char *title,
- const char *icon_directory,
- GtkWindow *owner,
- EelIconSelectionFunction selected,
- gpointer callback_data);
-
+
char *eel_bonobo_make_registration_id (const char *iid);
GladeXML *eel_glade_get_file (const char *filename,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]