Tried adding click on image stuff

This commit is contained in:
Markus Koch 2016-06-06 22:20:38 +02:00
parent 477585cd2d
commit 70dcc379d5
4 changed files with 63 additions and 53 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkEntryCompletion" id="searchCompletion"/>

View File

@ -2,63 +2,69 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkBox" id="previewWidget">
<property name="width_request">200</property>
<object class="GtkEventBox" id="evBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="image">
<property name="height_request">150</property>
<property name="can_focus">False</property>
<property name="icon_name">applications-graphics</property>
<property name="use_fallback">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner">
<property name="height_request">150</property>
<object class="GtkBox" id="previewWidget">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="image">
<property name="height_request">150</property>
<property name="can_focus">False</property>
<property name="icon_name">applications-graphics</property>
<property name="use_fallback">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner">
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button">
<property name="label" translatable="yes">Download @ 0000 x 0000</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Debug</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="debugfoo" object="image" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button">
<property name="label" translatable="yes">Download @ 0000 x 0000</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Debug</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="debugfoo" object="image" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</interface>

View File

@ -93,11 +93,13 @@ void PreviewWidget_init(PreviewWidget *klass)
builder = gtk_builder_new();
gtk_builder_add_from_file(builder, "glade/previewWidget.glade", NULL);
widget = GTK_WIDGET(gtk_builder_get_object(GTK_BUILDER(builder), "previewWidget"));
widget = GTK_WIDGET(gtk_builder_get_object(GTK_BUILDER(builder), "evBox"));
gtk_builder_connect_signals(builder, NULL);
gtk_container_add(GTK_CONTAINER(klass), widget);
klass->evBox = widget;
gtk_widget_set_events (klass->evBox, GDK_BUTTON_PRESS_MASK); // TODO: Click event foo here
klass->image = GTK_WIDGET(gtk_builder_get_object(builder, "image"));
klass->button = GTK_WIDGET(gtk_builder_get_object(builder, "button"));
klass->spinner = GTK_WIDGET(gtk_builder_get_object(builder, "spinner"));
@ -114,6 +116,7 @@ GtkWidget *PreviewWidget_new(KonaImage* ki)
// Connect UI handlers
g_signal_connect(w->button, "clicked", (GCallback)kona_download_image, ki);
g_signal_connect(w->evBox, "button_press_event", (GCallback)kona_download_image, ki); // TODO: Click event foo here
return GTK_WIDGET(w);
}

View File

@ -18,6 +18,7 @@ typedef struct _PreviewWidgetClass PreviewWidgetClass;
struct _PreviewWidget {
GtkBin bin;
GtkWidget *evBox;
GtkWidget *image;
GtkWidget *button;
GtkWidget *spinner;