Fix for the new gnome libraries. It looks like glade does not like empty dockitems...

Original commit message from CVS:
Fix for the new gnome libraries. It looks like glade does not like
empty dockitems...
This commit is contained in:
Wim Taymans 2000-11-08 19:53:48 +00:00
parent 4454f1f2a2
commit a9a7f77e07
6 changed files with 115 additions and 18 deletions

View file

@ -118,18 +118,17 @@ gst_media_play_connect_func (const gchar *handler_name,
static void
gst_media_play_init(GstMediaPlay *mplay)
{
GtkWidget *gstplay;
GModule *symbols;
connect_struct data;
glade_init();
glade_gnome_init();
g_print("using %s\n", DATADIR"gstmediaplay.glade");
/* load the interface */
mplay->xml = glade_xml_new (DATADIR "gstmediaplay.glade", "gstplay");
mplay->xml = glade_xml_new (DATADIR"gstmediaplay.glade", "gstplay");
//mplay->xml = glade_xml_new ("/usr/local/share/gstplay/gstplay.glade", "gstplay");
g_assert (mplay->xml != NULL);
mplay->slider = glade_xml_get_widget(mplay->xml, "slider");
g_assert (mplay->slider != NULL);
{
GtkArg arg;
GtkRange *range;
@ -144,15 +143,20 @@ gst_media_play_init(GstMediaPlay *mplay)
}
mplay->play_button = glade_xml_get_widget (mplay->xml, "toggle_play");
g_assert (mplay->play_button != NULL);
mplay->pause_button = glade_xml_get_widget (mplay->xml, "toggle_pause");
g_assert (mplay->pause_button != NULL);
mplay->stop_button = glade_xml_get_widget (mplay->xml, "toggle_stop");
g_assert (mplay->stop_button != NULL);
gstplay = glade_xml_get_widget (mplay->xml, "gstplay");
gtk_drag_dest_set (gstplay,
mplay->window = glade_xml_get_widget (mplay->xml, "gstplay");
g_assert (mplay->window != NULL);
gtk_drag_dest_set (mplay->window,
GTK_DEST_DEFAULT_ALL,
target_table, 1,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (gstplay), "drag_data_received",
gtk_signal_connect (GTK_OBJECT (mplay->window), "drag_data_received",
GTK_SIGNAL_FUNC (target_drag_data_received),
NULL);
@ -175,7 +179,7 @@ gst_media_play_init(GstMediaPlay *mplay)
gtk_widget_show (GTK_WIDGET (mplay->play));
mplay->status = gst_status_area_new();
mplay->status = glade_xml_get_widget (mplay->xml, "status_area");
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
@ -186,10 +190,6 @@ gst_media_play_init(GstMediaPlay *mplay)
glade_xml_signal_autoconnect_full (mplay->xml, gst_media_play_connect_func, &data);
gtk_container_add (GTK_CONTAINER (glade_xml_get_widget (mplay->xml, "dockitem4")),
GTK_WIDGET (mplay->status));
gtk_widget_show (GTK_WIDGET (mplay->status));
mplay->last_time = 0;
}
@ -226,6 +226,9 @@ gst_media_play_start_uri (GstMediaPlay *play,
gtk_widget_set_sensitive (play->slider, FALSE);
}
gtk_window_set_title (GTK_WINDOW (play->window),
g_strconcat ( "Gstplay - ", uri, NULL));
gst_play_play (play->play);
}
}
@ -310,6 +313,15 @@ on_gst_media_play_delete_event (GtkWidget *widget,
return FALSE;
}
void
on_extended1_activate (GtkCheckMenuItem *item,
GstMediaPlay *mplay)
{
gdk_threads_leave ();
gst_status_area_show_extended (mplay->status, item->active);
gdk_threads_enter ();
}
static void
gst_media_play_frame_displayed (GstPlay *play,
GstMediaPlay *mplay)

View file

@ -138,6 +138,19 @@
<class>GtkMenu</class>
<name>view1_menu</name>
<widget>
<class>GtkCheckMenuItem</class>
<name>extended1</name>
<signal>
<name>activate</name>
<handler>on_extended1_activate</handler>
<last_modification_time>Mon, 06 Nov 2000 21:52:57 GMT</last_modification_time>
</signal>
<label>_Extended</label>
<active>False</active>
<always_show_toggle>False</always_show_toggle>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>media1</name>
@ -252,7 +265,7 @@
<widget>
<class>GnomeDockItem</class>
<name>dockitem3</name>
<border_width>2</border_width>
<border_width>1</border_width>
<placement>GNOME_DOCK_BOTTOM</placement>
<band>0</band>
<position>0</position>
@ -284,7 +297,6 @@
<widget>
<class>GnomeDockItem</class>
<name>dockitem2</name>
<border_width>1</border_width>
<placement>GNOME_DOCK_BOTTOM</placement>
<band>1</band>
<position>0</position>
@ -369,7 +381,12 @@
<shadow_type>GTK_SHADOW_OUT</shadow_type>
<widget>
<class>Placeholder</class>
<class>Custom</class>
<name>status_area</name>
<creation_function>gst_status_area_new</creation_function>
<int1>0</int1>
<int2>0</int2>
<last_modification_time>Wed, 08 Nov 2000 19:56:51 GMT</last_modification_time>
</widget>
</widget>

View file

@ -35,6 +35,7 @@ struct _GstMediaPlay {
GtkWidget *play_button;
GtkWidget *pause_button;
GtkWidget *stop_button;
GtkWidget *window;
GstStatusArea *status;

View file

@ -17,6 +17,7 @@ static void gst_status_area_realize(GtkWidget *status_area);
static gint gst_status_area_expose(GtkWidget *widget, GdkEventExpose *event);
#define DEFAULT_HEIGHT 20
#define DEFAULT_EXPANDED_HEIGHT 100
/* signals and args */
enum {
@ -75,6 +76,7 @@ gst_status_area_init (GstStatusArea *status_area)
GTK_WIDGET(status_area)->requisition.height = DEFAULT_HEIGHT;
status_area->state = GST_STATUS_AREA_STATE_INIT;
status_area->expanded = FALSE;
}
GstStatusArea *
@ -135,6 +137,56 @@ gst_status_area_expose(GtkWidget *widget,
widget->allocation.width,
widget->allocation.height);
if (status_area->expanded) {
gint width;
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 20,
widget->allocation.width, widget->allocation.height - 20);
width = gdk_string_width (widget->style->font, "Show:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 15,
"Show:");
width = gdk_string_width (widget->style->font, "Clip:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 40,
"Clip:");
width = gdk_string_width (widget->style->font, "Author:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 55,
"Author:");
width = gdk_string_width (widget->style->font, "Copyright:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 70,
"Copyright:");
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 80,
widget->allocation.width, widget->allocation.height - 80);
}
switch (status_area->state) {
case GST_STATUS_AREA_STATE_INIT:
statustext = "Initializing";
@ -156,7 +208,8 @@ gst_status_area_expose(GtkWidget *widget,
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
8, 15, statustext);
8, widget->allocation.height-5,
statustext);
if (status_area->playtime) {
gint width = gdk_string_width (widget->style->font, status_area->playtime);
@ -164,7 +217,9 @@ gst_status_area_expose(GtkWidget *widget,
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
widget->allocation.width-width-20, 15, status_area->playtime);
widget->allocation.width-width-20,
widget->allocation.height-5,
status_area->playtime);
}
}
@ -210,6 +265,15 @@ void
gst_status_area_show_extended (GstStatusArea *area,
gboolean show)
{
area->expanded = show;
if (show) {
GTK_WIDGET(area)->requisition.height = DEFAULT_EXPANDED_HEIGHT;
}
else {
GTK_WIDGET(area)->requisition.height = DEFAULT_HEIGHT;
}
gtk_widget_queue_resize (GTK_WIDGET (area));
}
static void

View file

@ -30,6 +30,7 @@ struct _GstStatusArea {
GstStatusAreaState state;
guchar *playtime;
gboolean expanded;
};
struct _GstStatusAreaClass {

View file

@ -15,6 +15,8 @@ main (int argc, char *argv[])
gst_init (&argc,&argv);
gnome_init ("gstreamer", VERSION, argc, argv);
glade_init();
glade_gnome_init();
play = gst_media_play_new ();