Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

file_select.c File Reference

#include "intl.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "file_select.h"

Include dependency graph for file_select.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  eb_file_selector_data

Functions

void file_selector_cancel_callback (GtkButton *button, gpointer data)
void file_selector_ok_callback (GtkButton *button, gpointer data)
void do_file_selector (char *default_filename, char *title, void(*action_ok)(GtkButton *button, gpointer data), void(*action_cancel)(GtkButton *button, gpointer data), gpointer data)
void eb_do_file_selector (char *default_filename, char *window_title, void(*callback)(char *filename, gpointer data), gpointer data)


Function Documentation

void do_file_selector char *    default_filename,
char *    title,
void(*    action_ok)(GtkButton *button, gpointer data),
void(*    action_cancel)(GtkButton *button, gpointer data),
gpointer    data
[static]
 

Definition at line 34 of file file_select.c.

References title.

Referenced by eb_do_file_selector().

00038 {
00039     GtkWidget *file_selector;
00040     GtkWidget *ok_button;
00041     GtkWidget *cancel_button;
00042 
00043     file_selector = gtk_file_selection_new(title);
00044     gtk_object_set_data (GTK_OBJECT (file_selector), "file_selector", file_selector);
00045     gtk_container_set_border_width (GTK_CONTAINER (file_selector), 10);
00046     /*gtk_window_set_modal (GTK_WINDOW (file_selector), TRUE);*/
00047 
00048     ok_button = GTK_FILE_SELECTION (file_selector)->ok_button;
00049     gtk_object_set_data (GTK_OBJECT (file_selector), "ok_button", ok_button);
00050     gtk_widget_show (ok_button);
00051     GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
00052 
00053     cancel_button = GTK_FILE_SELECTION (file_selector)->cancel_button;
00054     gtk_object_set_data (GTK_OBJECT (file_selector), "cancel_button", cancel_button);
00055     gtk_widget_show (cancel_button);
00056     GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
00057 
00058     gtk_signal_connect(GTK_OBJECT (ok_button), "clicked",
00059                         GTK_SIGNAL_FUNC (action_ok), data);
00060 
00061     gtk_signal_connect_object(GTK_OBJECT (ok_button), "clicked",
00062                                GTK_SIGNAL_FUNC (gtk_widget_destroy),
00063                                GTK_OBJECT (file_selector));
00064 
00065     gtk_signal_connect(GTK_OBJECT (cancel_button), "clicked",
00066                         GTK_SIGNAL_FUNC (action_cancel), data);
00067 
00068     gtk_signal_connect_object(GTK_OBJECT (cancel_button), "clicked",
00069                                GTK_SIGNAL_FUNC (gtk_widget_destroy),
00070                                GTK_OBJECT (file_selector));
00071 
00072     if(default_filename)
00073         gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_selector), default_filename);
00074 
00075     gtk_widget_show (file_selector);
00076 }

void eb_do_file_selector char *    default_filename,
char *    window_title,
void(*    callback)(char *filename, gpointer data),
gpointer    data
 

Definition at line 78 of file file_select.c.

References eb_file_selector_data::callback, eb_file_selector_data::data, do_file_selector(), file_selector_cancel_callback(), and file_selector_ok_callback().

Referenced by browse_file(), eb_do_send_file(), and getsoundfile().

00080 {
00081     struct eb_file_selector_data *efsd = g_new0(struct eb_file_selector_data, 1);
00082     efsd->callback = callback;
00083     efsd->data = data;
00084 
00085     do_file_selector(default_filename, window_title, 
00086             file_selector_ok_callback, file_selector_cancel_callback, efsd);
00087 }

void file_selector_cancel_callback GtkButton *    button,
gpointer    data
[static]
 

Definition at line 19 of file file_select.c.

References eb_file_selector_data::callback, and eb_file_selector_data::data.

Referenced by eb_do_file_selector().

00020 {
00021     struct eb_file_selector_data *efsd = (struct eb_file_selector_data *)data;
00022 
00023     efsd->callback(NULL, efsd->data);
00024 }

void file_selector_ok_callback GtkButton *    button,
gpointer    data
[static]
 

Definition at line 26 of file file_select.c.

References eb_file_selector_data::callback, and eb_file_selector_data::data.

Referenced by eb_do_file_selector().

00027 {
00028     struct eb_file_selector_data *efsd = (struct eb_file_selector_data *)data;
00029     char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(gtk_widget_get_toplevel(GTK_WIDGET(button))));
00030 
00031     efsd->callback(filename, efsd->data);
00032 }


Contact: Andy Maloney     [Documentation generated by doxygen]