Commit fc39d649 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Familiar Linux interface (non functional yet).

parent 91cf1f1b
familiar_SOURCES = familiar.c familiar_interface.c familiar_support.c familiar_callbacks.c
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Familiar</name>
<program_name>familiar</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>share</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
<gettext_support>True</gettext_support>
<main_source_file>familiar_interface.c</main_source_file>
<main_header_file>familiar_interface.h</main_header_file>
<handler_source_file>familiar_callbacks.c</handler_source_file>
<handler_header_file>familiar_callbacks.h</handler_header_file>
<support_source_file>familiar_support.c</support_source_file>
<support_header_file>familiar_support.h</support_header_file>
</project>
<widget>
<class>GtkWindow</class>
<name>familiar</name>
<width>240</width>
<height>320</height>
<title>vlc (familiar)</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkToolbar</class>
<name>toolbar</name>
<width>112</width>
<height>16</height>
<orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
<type>GTK_TOOLBAR_ICONS</type>
<space_size>5</space_size>
<space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style>
<relief>GTK_RELIEF_NORMAL</relief>
<tooltips>True</tooltips>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkPixmap</class>
<name>xpm_open</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_open_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:11 GMT</last_modification_time>
</signal>
<filename>familiar-openb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_preferences</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_preferences_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:17:55 GMT</last_modification_time>
</signal>
<filename>familiar-preferencesb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_rewind</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_rewind_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:17 GMT</last_modification_time>
</signal>
<filename>familiar-rewindb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
<child>
<new_group>True</new_group>
</child>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_pause</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_pause_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:29 GMT</last_modification_time>
</signal>
<filename>familiar-pauseb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_play</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_play_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:36 GMT</last_modification_time>
</signal>
<filename>familiar-playb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_stop</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_stop_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:43 GMT</last_modification_time>
</signal>
<filename>familiar-stopb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
<widget>
<class>GtkPixmap</class>
<name>xpm_forward</name>
<can_focus>True</can_focus>
<signal>
<name>button_press_event</name>
<handler>on_xpm_forward_button_press_event</handler>
<last_modification_time>Mon, 22 Jul 2002 13:18:55 GMT</last_modification_time>
</signal>
<filename>familiar-forwardb16x16.xpm</filename>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<build_insensitive>True</build_insensitive>
</widget>
</widget>
<widget>
<class>GtkProgressBar</class>
<name>progress</name>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
<activity_mode>True</activity_mode>
<show_text>False</show_text>
<format>%P %%</format>
<text_xalign>0.5</text_xalign>
<text_yalign>0.5</text_yalign>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkNotebook</class>
<name>notebook</name>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>media</name>
<label>Media</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>preference</name>
<label>Preference</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>help</name>
<label>Help</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>about</name>
<label>About</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>
/*****************************************************************************
* familiar.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.1 2002/07/22 13:49:42 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
* 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, USA.
*****************************************************************************/
/*****************************************************************************
* Drag'n'drop stuff
*****************************************************************************/
#define DROP_ACCEPT_TEXT_URI_LIST 0
#define DROP_ACCEPT_TEXT_PLAIN 1
#define DROP_ACCEPT_STRING 2
#define MAX_ATEXIT 10
/*****************************************************************************
* intf_sys_t: description and status of Gtk+ interface
*****************************************************************************/
struct intf_sys_t
{
/* special actions */
vlc_bool_t b_playing;
vlc_bool_t b_popup_changed; /* display menu ? */
vlc_bool_t b_window_changed; /* window display toggled ? */
vlc_bool_t b_playlist_changed; /* playlist display toggled ? */
vlc_bool_t b_slider_free; /* slider status */
/* menus handlers */
vlc_bool_t b_program_update; /* do we need to update programs
menu */
vlc_bool_t b_title_update; /* do we need to update title menus */
vlc_bool_t b_chapter_update; /* do we need to update
chapter menus */
vlc_bool_t b_audio_update; /* do we need to update audio menus */
vlc_bool_t b_spu_update; /* do we need to update spu menus */
/* windows and widgets */
GtkWidget * p_window; /* main window */
GtkWidget * p_popup; /* popup menu */
GtkWidget * p_playwin; /* playlist */
GtkWidget * p_modules; /* module manager */
GtkWidget * p_about; /* about window */
GtkWidget * p_open; /* multiopen window */
GtkWidget * p_jump; /* jump window */
GtkTooltips * p_tooltips; /* tooltips */
/* The input thread */
input_thread_t * p_input;
/* The slider */
GtkFrame * p_slider_frame;
GtkAdjustment * p_adj; /* slider adjustment object */
float f_adj_oldvalue; /* previous value */
/* The messages window */
GtkWidget * p_messages; /* messages window */
GtkText * p_messages_text; /* messages frame */
msg_subscription_t* p_sub; /* message bank subscription */
/* Playlist management */
int i_playing; /* playlist selected item */
/* The window labels for DVD mode */
GtkLabel * p_label_title;
GtkLabel * p_label_chapter;
gint i_part; /* current chapter */
/* XXX: Ugly kludge, see gtk.c */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
};
/*****************************************************************************
* Prototypes
*****************************************************************************/
gint GtkModeManage ( intf_thread_t * p_intf );
void GtkDisplayDate ( GtkAdjustment *p_adj );
/*****************************************************************************
* Useful macro
****************************************************************************/
#define GtkGetIntf( widget ) __GtkGetIntf( GTK_WIDGET( widget ) )
void * __GtkGetIntf( GtkWidget * );
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "familiar_callbacks.h"
#include "familiar_interface.h"
#include "familiar_support.h"
gboolean
on_xpm_open_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_preferences_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_rewind_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_pause_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_play_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_stop_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
gboolean
on_xpm_forward_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return FALSE;
}
#include <gtk/gtk.h>
gboolean
on_xpm_open_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_preferences_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_rewind_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_pause_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_play_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_stop_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_xpm_forward_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "familiar_callbacks.h"
#include "familiar_interface.h"
#include "familiar_support.h"
GtkWidget*
create_familiar (void)
{
GtkWidget *familiar;
GtkWidget *vbox;
GtkWidget *toolbar;
GtkWidget *xpm_open;
GtkWidget *xpm_preferences;
GtkWidget *xpm_rewind;
GtkWidget *xpm_pause;
GtkWidget *xpm_play;
GtkWidget *xpm_stop;
GtkWidget *xpm_forward;
GtkWidget *progress;
GtkWidget *notebook;
GtkWidget *empty_notebook_page;
GtkWidget *media;
GtkWidget *preference;
GtkWidget *help;
GtkWidget *about;
familiar = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (familiar), "familiar", familiar);
gtk_widget_set_usize (familiar, 240, 320);
gtk_window_set_title (GTK_WINDOW (familiar), _("vlc (familiar)"));
gtk_window_set_policy (GTK_WINDOW (familiar), FALSE, FALSE, FALSE);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox);
gtk_object_set_data_full (GTK_OBJECT (familiar), "vbox", vbox,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (familiar), vbox);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
gtk_widget_ref (toolbar);
gtk_object_set_data_full (GTK_OBJECT (familiar), "toolbar", toolbar,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar);
gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
gtk_widget_set_usize (toolbar, 112, 16);
xpm_open = create_pixmap (familiar, "familiar-openb16x16.xpm");
gtk_widget_ref (xpm_open);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_open", xpm_open,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_open);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_open, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_open, GTK_CAN_FOCUS);
xpm_preferences = create_pixmap (familiar, "familiar-preferencesb16x16.xpm");
gtk_widget_ref (xpm_preferences);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_preferences", xpm_preferences,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_preferences);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_preferences, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_preferences, GTK_CAN_FOCUS);
xpm_rewind = create_pixmap (familiar, "familiar-rewindb16x16.xpm");
gtk_widget_ref (xpm_rewind);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_rewind", xpm_rewind,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_rewind);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_rewind, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_rewind, GTK_CAN_FOCUS);
xpm_pause = create_pixmap (familiar, "familiar-pauseb16x16.xpm");
gtk_widget_ref (xpm_pause);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_pause", xpm_pause,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_pause);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_pause, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_pause, GTK_CAN_FOCUS);
xpm_play = create_pixmap (familiar, "familiar-playb16x16.xpm");
gtk_widget_ref (xpm_play);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_play", xpm_play,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_play);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_play, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_play, GTK_CAN_FOCUS);
xpm_stop = create_pixmap (familiar, "familiar-stopb16x16.xpm");
gtk_widget_ref (xpm_stop);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_stop", xpm_stop,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_stop);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_stop, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_stop, GTK_CAN_FOCUS);
xpm_forward = create_pixmap (familiar, "familiar-forwardb16x16.xpm");
gtk_widget_ref (xpm_forward);
gtk_object_set_data_full (GTK_OBJECT (familiar), "xpm_forward", xpm_forward,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (xpm_forward);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), xpm_forward, NULL, NULL);
GTK_WIDGET_SET_FLAGS (xpm_forward, GTK_CAN_FOCUS);
progress = gtk_progress_bar_new ();
gtk_widget_ref (progress);
gtk_object_set_data_full (GTK_OBJECT (familiar), "progress", progress,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (progress);
gtk_box_pack_start (GTK_BOX (vbox), progress, FALSE, FALSE, 0);
gtk_progress_set_activity_mode (GTK_PROGRESS (progress), TRUE);
notebook = gtk_notebook_new ();
gtk_widget_ref (notebook);
gtk_object_set_data_full (GTK_OBJECT (familiar), "notebook", notebook,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (notebook);
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
empty_notebook_page = gtk_vbox_new (FALSE, 0);
gtk_widget_show (empty_notebook_page);
gtk_container_add (GTK_CONTAINER (notebook), empty_notebook_page);
media = gtk_label_new (_("Media"));
gtk_widget_ref (media);
gtk_object_set_data_full (GTK_OBJECT (familiar), "media", media,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (media);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), media);
empty_notebook_page = gtk_vbox_new (FALSE, 0);
gtk_widget_show (empty_notebook_page);
gtk_container_add (GTK_CONTAINER (notebook), empty_notebook_page);
preference = gtk_label_new (_("Preference"));
gtk_widget_ref (preference);
gtk_object_set_data_full (GTK_OBJECT (familiar), "preference", preference,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preference);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), preference);
empty_notebook_page = gtk_vbox_new (FALSE, 0);
gtk_widget_show (empty_notebook_page);
gtk_container_add (GTK_CONTAINER (notebook), empty_notebook_page);
help = gtk_label_new (_("Help"));
gtk_widget_ref (help);
gtk_object_set_data_full (GTK_OBJECT (familiar), "help", help,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (help);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), help);
empty_notebook_page = gtk_vbox_new (FALSE, 0);
gtk_widget_show (empty_notebook_page);
gtk_container_add (GTK_CONTAINER (notebook), empty_notebook_page);
about = gtk_label_new (_("About"));
gtk_widget_ref (about);
gtk_object_set_data_full (GTK_OBJECT (familiar), "about", about,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (about);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 3), about);
gtk_signal_connect (GTK_OBJECT (xpm_open), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_open_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_preferences), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_preferences_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_rewind), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_rewind_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_pause), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_pause_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_play), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_play_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_stop), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_stop_button_press_event),
NULL);
gtk_signal_connect (GTK_OBJECT (xpm_forward), "button_press_event",
GTK_SIGNAL_FUNC (on_xpm_forward_button_press_event),
NULL);
return familiar;
}
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_familiar (void);
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include "familiar_support.h"
/* This is an internally used function to check if a pixmap file exists. */
static gchar* check_file_exists (const gchar *directory,
const gchar *filename);
/* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget);
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
/* This is a dummy pixmap we use when a pixmap can't be found. */
static char *dummy_pixmap_xpm[] = {
/* columns rows colors chars-per-pixel */
"1 1 1 1",
" c None",
/* pixels */
" "
};
/* This is an internally used function to create pixmaps. */
static GtkWidget*
create_dummy_pixmap (GtkWidget *widget)
{
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
NULL, dummy_pixmap_xpm);
if (gdkpixmap == NULL)
g_error ("Couldn't create replacement pixmap.");
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *found_filename = NULL;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
GList *elem;
if (!filename || !filename[0])
return create_dummy_pixmap (widget);
/* We first try any pixmaps directories set by the application. */
elem = pixmaps_directories;
while (elem)
{
found_filename = check_file_exists ((gchar*)elem->data, filename);
if (found_filename)
break;
elem = elem->next;
}
/* If we haven't found the pixmap, try the source directory. */
if (!found_filename)
{
found_filename = check_file_exists ("../share", filename);
}
if (!found_filename)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return create_dummy_pixmap (widget);
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
NULL, found_filename);
if (gdkpixmap == NULL)
{
g_warning (_("Error loading pixmap file: %s"), found_filename);
g_free (found_filename);
return create_dummy_pixmap (widget);
}
g_free (found_filename);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
/* This is an internally used function to check if a pixmap file exists. */
static gchar*
check_file_exists (const gchar *directory,
const gchar *filename)
{
gchar *full_filename;
struct stat s;
gint status;
full_filename = (gchar*) g_malloc (strlen (directory) + 1
+ strlen (filename) + 1);
strcpy (full_filename, directory);
strcat (full_filename, G_DIR_SEPARATOR_S);
strcat (full_filename, filename);
status = stat (full_filename, &s);
if (status == 0 && S_ISREG (s.st_mode))
return full_filename;
g_free (full_filename);
return NULL;
}
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment