Removed moo/mooutils/moofilechooser.[ch]

master
Yevgen Muntyan 2005-08-08 13:08:12 +00:00
parent e3c36a05a2
commit e284443692
4 changed files with 1 additions and 253 deletions

View File

@ -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

View File

@ -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,

View File

@ -1,188 +0,0 @@
/*
* mooutils/moofilechooser.c
*
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* 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 <string.h>
/* 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
}

View File

@ -1,53 +0,0 @@
/*
* mooutils/moofilechooser.h
*
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* 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 <gtk/gtk.h>
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 */