From: Wim Taymans Date: Wed, 8 Nov 2000 19:53:48 +0000 (+0000) Subject: Fix for the new gnome libraries. It looks like glade does not like empty dockitems... X-Git-Tag: RELEASE-0_1_0-SLIPSTREAM~277 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9a7f77e0790faf39d130e0f144b6335f3a28dad;p=platform%2Fupstream%2Fgstreamer.git 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... --- diff --git a/gstplay/gstmediaplay.c b/gstplay/gstmediaplay.c index 2d0c432..b31cf93 100644 --- a/gstplay/gstmediaplay.c +++ b/gstplay/gstmediaplay.c @@ -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); + + mplay->window = glade_xml_get_widget (mplay->xml, "gstplay"); + g_assert (mplay->window != NULL); - gstplay = glade_xml_get_widget (mplay->xml, "gstplay"); - gtk_drag_dest_set (gstplay, + 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) diff --git a/gstplay/gstmediaplay.glade b/gstplay/gstmediaplay.glade index 678a699..8a83ffe 100644 --- a/gstplay/gstmediaplay.glade +++ b/gstplay/gstmediaplay.glade @@ -139,6 +139,19 @@ view1_menu + GtkCheckMenuItem + extended1 + + activate + on_extended1_activate + Mon, 06 Nov 2000 21:52:57 GMT + + + False + False + + + GtkMenuItem media1 @@ -252,7 +265,7 @@ GnomeDockItem dockitem3 - 2 + 1 GNOME_DOCK_BOTTOM 0 0 @@ -284,7 +297,6 @@ GnomeDockItem dockitem2 - 1 GNOME_DOCK_BOTTOM 1 0 @@ -369,7 +381,12 @@ GTK_SHADOW_OUT - Placeholder + Custom + status_area + gst_status_area_new + 0 + 0 + Wed, 08 Nov 2000 19:56:51 GMT diff --git a/gstplay/gstmediaplay.h b/gstplay/gstmediaplay.h index 7a47716..7b97b3e 100644 --- a/gstplay/gstmediaplay.h +++ b/gstplay/gstmediaplay.h @@ -35,6 +35,7 @@ struct _GstMediaPlay { GtkWidget *play_button; GtkWidget *pause_button; GtkWidget *stop_button; + GtkWidget *window; GstStatusArea *status; diff --git a/gstplay/gststatusarea.c b/gstplay/gststatusarea.c index 7cd1b39..8ddce0a 100644 --- a/gstplay/gststatusarea.c +++ b/gstplay/gststatusarea.c @@ -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 diff --git a/gstplay/gststatusarea.h b/gstplay/gststatusarea.h index ba3a2e7..f1adff5 100644 --- a/gstplay/gststatusarea.h +++ b/gstplay/gststatusarea.h @@ -30,6 +30,7 @@ struct _GstStatusArea { GstStatusAreaState state; guchar *playtime; + gboolean expanded; }; struct _GstStatusAreaClass { diff --git a/gstplay/main.c b/gstplay/main.c index f7c8f28..cf9864d 100644 --- a/gstplay/main.c +++ b/gstplay/main.c @@ -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 ();