widget-factory: Add another osd

This is modeled after the totem osd.
This commit is contained in:
Matthias Clasen 2014-11-05 00:27:13 -05:00
parent dd721acb84
commit 45c0461f9b
2 changed files with 149 additions and 36 deletions

View File

@ -1073,6 +1073,19 @@ textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *butt
gtk_widget_set_sensitive (button, has_selection);
}
static gboolean
osd_frame_button_press (GtkWidget *frame, GdkEventButton *event, gpointer data)
{
GtkWidget *osd;
gboolean visible;
osd = g_object_get_data (G_OBJECT (frame), "osd");
visible = gtk_widget_get_visible (osd);
gtk_widget_set_visible (osd, !visible);
return GDK_EVENT_STOP;
}
static void
activate (GApplication *app)
{
@ -1119,6 +1132,7 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press);
gtk_builder_connect_signals (builder, NULL);
@ -1266,6 +1280,10 @@ activate (GApplication *app)
g_signal_connect (gtk_widget_get_clipboard (widget2, GDK_SELECTION_CLIPBOARD), "owner-change",
G_CALLBACK (clipboard_owner_change), widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "totem_like_osd");
g_object_set_data (G_OBJECT (widget), "osd", widget2);
gtk_widget_show_all (GTK_WIDGET (window));
g_object_unref (builder);

View File

@ -82,6 +82,7 @@
</menu>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="lower">1</property>
<property name="value">50</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
@ -3711,60 +3712,154 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkFrame">
<object class="GtkOverlay">
<property name="visible">True</property>
<child>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="wide-handle">True</property>
<child type="overlay">
<object class="GtkToolbar" id="totem_like_osd">
<property name="no-show-all">True</property>
<property name="opacity">0.9</property>
<property name="margin">20</property>
<property name="halign">fill</property>
<property name="valign">end</property>
<style>
<class name="osd"/>
</style>
<child>
<object class="GtkNotebook">
<object class="GtkToolItem">
<property name="visible">True</property>
<property name="show-border">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="height-request">120</property>
<property name="orientation">horizontal</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">pan-start-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">pan-end-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 1</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="height-request">120</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 2</property>
</object>
</child>
</object>
</object>
</child>
<child>
<object class="GtkNotebook">
<object class="GtkToolItem">
<property name="visible">True</property>
<property name="show-border">False</property>
<child>
<object class="GtkBox">
<object class="GtkScale">
<property name="visible">True</property>
<property name="height-request">120</property>
<property name="draw-value">False</property>
<property name="orientation">horizontal</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkToolItem">
<property name="visible">True</property>
<child>
<object class="GtkVolumeButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 3</property>
<property name="orientation">vertical</property>
<property name="use-symbolic">True</property>
<property name="value">.5</property>
<style>
<class name="image-button"/>
</style>
</object>
</child>
</object>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="osd_frame">
<property name="visible">True</property>
<signal name="button-press-event" handler="osd_frame_button_press"/>
<child>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="wide-handle">True</property>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
<property name="show-border">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="height-request">120</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 1</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="vexpand">True</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 2</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
<property name="show-border">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="vexpand">True</property>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 3</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>