From e28444369217f1ea2d49190f1082a312a6f61b0d Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Mon, 8 Aug 2005 13:08:12 +0000 Subject: [PATCH] Removed moo/mooutils/moofilechooser.[ch] --- moo/mooutils/Makefile.am | 8 -- moo/mooutils/moodialogs.c | 5 +- moo/mooutils/moofilechooser.c | 188 ---------------------------------- moo/mooutils/moofilechooser.h | 53 ---------- 4 files changed, 1 insertion(+), 253 deletions(-) delete mode 100644 moo/mooutils/moofilechooser.c delete mode 100644 moo/mooutils/moofilechooser.h diff --git a/moo/mooutils/Makefile.am b/moo/mooutils/Makefile.am index b030ee1e..5a0d0102 100644 --- a/moo/mooutils/Makefile.am +++ b/moo/mooutils/Makefile.am @@ -96,17 +96,9 @@ nodist_libmooutils_la_SOURCES = \ moomarshals.h CLEANFILES = $(nodist_libmooutils_la_SOURCES) -if GTK_2_4 -libmooutils_la_SOURCES += \ - moofilechooser.c \ - moofilechooser.h -endif GTK_2_4 - EXTRA_DIST = \ $(unrtf_src) \ $(python_sources) \ - moofilechooser.c \ - moofilechooser.h \ moomarshals.list \ xml2h.sh diff --git a/moo/mooutils/moodialogs.c b/moo/mooutils/moodialogs.c index d65136f4..1ab42897 100644 --- a/moo/mooutils/moodialogs.c +++ b/moo/mooutils/moodialogs.c @@ -15,9 +15,6 @@ #include "mooutils/moodialogs.h" #include "mooutils/mooprefs.h" #include "mooutils/moowin.h" -#if GTK_CHECK_VERSION(2,4,0) -#include "mooutils/moofilechooser.h" -#endif static void message_dialog (GtkWidget *parent, @@ -142,7 +139,7 @@ GtkWidget *file_chooser_dialog_new (const char *title, const char *okbtn, const char *start_dir) { - GtkWidget *dialog = moo_file_chooser_new ( + GtkWidget *dialog = gtk_file_chooser_dialog_new ( title, parent, action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, okbtn, GTK_RESPONSE_OK, diff --git a/moo/mooutils/moofilechooser.c b/moo/mooutils/moofilechooser.c deleted file mode 100644 index 1812dbea..00000000 --- a/moo/mooutils/moofilechooser.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * mooutils/moofilechooser.c - * - * Copyright (C) 2004-2005 by Yevgen Muntyan - * - * 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. - * - * See COPYING file that comes with this distribution. - */ - -#include "mooutils/moofilechooser.h" -#include - - -/* MOO_TYPE_FILE_CHOOSER */ -G_DEFINE_TYPE (MooFileChooser, moo_file_chooser, GTK_TYPE_FILE_CHOOSER_DIALOG) - -static void moo_file_chooser_finalize (GObject *object); -static GObject *moo_file_chooser_constructor (GType type, - guint n_props, - GObjectConstructParam *props); - -static void screw_file_chooser (MooFileChooser *dialog); - - -static void moo_file_chooser_class_init (MooFileChooserClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - gobject_class->constructor = moo_file_chooser_constructor; - gobject_class->finalize = moo_file_chooser_finalize; -} - - -static void moo_file_chooser_init (MooFileChooser *dialog) -{ - dialog->shortcuts_vbox = NULL; -} - - -static void moo_file_chooser_finalize (GObject *object) -{ - MooFileChooser *dialog = MOO_FILE_CHOOSER (object); - - if (dialog->shortcuts_vbox) - g_object_unref (dialog->shortcuts_vbox); - dialog->shortcuts_vbox = NULL; - - G_OBJECT_CLASS(moo_file_chooser_parent_class)->finalize (object); -} - - -static GObject *moo_file_chooser_constructor (GType type, - guint n_props, - GObjectConstructParam *props) -{ - GObject *object; - MooFileChooser *dialog; - - object = G_OBJECT_CLASS(moo_file_chooser_parent_class)->constructor (type, - n_props, props); - dialog = MOO_FILE_CHOOSER (object); - - screw_file_chooser (dialog); - - if (dialog->shortcuts_vbox) - { - GtkWidget *parent = dialog->shortcuts_vbox->parent; - g_return_val_if_fail (parent != NULL, object); - gtk_container_remove (GTK_CONTAINER (parent), - dialog->shortcuts_vbox); - } - - return object; -} - - -static GtkWidget *moo_file_chooser_new_valist (const char *title, - GtkWindow *parent, - GtkFileChooserAction action, - const char *backend, - const char *first_button_text, - va_list args) -{ - GtkWidget *dialog; - const char *button_text = first_button_text; - int response_id; - - dialog = g_object_new (MOO_TYPE_FILE_CHOOSER, - "title", title, - "action", action, - "file-system-backend", backend, - NULL); - - if (parent) - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); - - while (button_text) - { - response_id = va_arg (args, int); - gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id); - button_text = va_arg (args, const char *); - } - - return dialog; -} - - -GtkWidget *moo_file_chooser_new (const char *title, - GtkWindow *parent, - GtkFileChooserAction action, - const gchar *first_button_text, - ...) -{ - GtkWidget *dialog; - va_list args; - - va_start (args, first_button_text); - dialog = moo_file_chooser_new_valist (title, parent, action, - NULL, first_button_text, - args); - va_end (args); - - return dialog; -} - - -#define LIST_FREE(l) g_list_free (l); l = NULL - -static void screw_file_chooser (MooFileChooser *dialog) -{ - /* - dialog -> vbox -> GtkFileChooserWidget -> GtkFileChooserDefault - - GtkFileChooserDefault is a vbox containing three children - - save mode stuff; browse stuff; extra widget - - browse_stuff: vbox -> hpaned - hpaned contains shortcuts widgets and files treeview - */ - - GtkWidget *vbox, *filechooser, *filechooser_default; - GtkWidget *browse_stuff, *hpaned; - GtkWidget *shortcuts_vbox; - GList *children; - - vbox = GTK_DIALOG(dialog)->vbox; - - children = gtk_container_get_children (GTK_CONTAINER (vbox)); - g_return_if_fail (children != NULL); - filechooser = children->data; - LIST_FREE(children); - g_return_if_fail (GTK_IS_FILE_CHOOSER_WIDGET (filechooser)); - - children = gtk_container_get_children (GTK_CONTAINER (filechooser)); - g_return_if_fail (children != NULL); - filechooser_default = children->data; - LIST_FREE(children); - g_return_if_fail (filechooser_default != NULL && - !strcmp (g_type_name (G_OBJECT_TYPE (filechooser_default)), "GtkFileChooserDefault")); - - children = gtk_container_get_children (GTK_CONTAINER (filechooser_default)); - g_return_if_fail (children != NULL); - if (!children->next) - { - g_list_free (children); - g_return_if_reached (); - } - browse_stuff = children->next->data; - LIST_FREE(children); - g_return_if_fail (GTK_IS_VBOX (browse_stuff)); - - children = gtk_container_get_children (GTK_CONTAINER (browse_stuff)); - g_return_if_fail (children != NULL); - hpaned = children->data; - LIST_FREE(children); - g_return_if_fail (GTK_IS_HPANED (hpaned)); - - shortcuts_vbox = gtk_paned_get_child1 (GTK_PANED (hpaned)); - g_return_if_fail (GTK_IS_VBOX (shortcuts_vbox)); - -#if 0 - dialog->shortcuts_vbox = shortcuts_vbox; - g_object_ref (shortcuts_vbox); -#endif -} diff --git a/moo/mooutils/moofilechooser.h b/moo/mooutils/moofilechooser.h deleted file mode 100644 index d3e0ccb0..00000000 --- a/moo/mooutils/moofilechooser.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * mooutils/moofilechooser.h - * - * Copyright (C) 2004-2005 by Yevgen Muntyan - * - * 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. - * - * See COPYING file that comes with this distribution. - */ - -#ifndef MOOUTILS_MOOFILECHOOSER_H -#define MOOUTILS_MOOFILECHOOSER_H - -#include - -G_BEGIN_DECLS - - -#define MOO_TYPE_FILE_CHOOSER (moo_file_chooser_get_type ()) -#define MOO_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_FILE_CHOOSER, MooFileChooser)) -#define MOO_FILE_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_FILE_CHOOSER, MooFileChooserClass)) -#define MOO_IS_FILE_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_FILE_CHOOSER)) -#define MOO_IS_FILE_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_FILE_CHOOSER)) -#define MOO_FILE_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_FILE_CHOOSER, MooFileChooserClass)) - -typedef struct _MooFileChooser MooFileChooser; -typedef struct _MooFileChooserClass MooFileChooserClass; - -struct _MooFileChooser { - GtkFileChooserDialog parent; - GtkWidget *shortcuts_vbox; -}; - -struct _MooFileChooserClass { - GtkFileChooserDialogClass parent_class; -}; - - -GType moo_file_chooser_get_type (void) G_GNUC_CONST; - -GtkWidget *moo_file_chooser_new (const char *title, - GtkWindow *parent, - GtkFileChooserAction action, - const gchar *first_button_text, - ...); - - -G_END_DECLS - -#endif /* MOOUTILS_MOOFILECHOOSER_H */