Compare commits

..

No commits in common. "61eee61c517b57fb2c0e81e007d6a3565e1dedf5" and "70dcc379d562e5885584341de81493bcc161858b" have entirely different histories.

6 changed files with 59 additions and 90 deletions

View File

@ -1,6 +1,6 @@
project(konaclient-gtk)
cmake_minimum_required(VERSION 2.8)
#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Release)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
@ -11,5 +11,5 @@ LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER})
add_subdirectory(libkonaclient)
add_subdirectory(libkonaclient-test)
add_subdirectory(konaclient-gtk)

View File

@ -2,15 +2,15 @@
<!-- 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="GtkEventBox" id="evBox">
<object class="GtkBox" id="previewWidget">
<property name="width_request">200</property>
<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>
@ -18,53 +18,53 @@
<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">True</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>
</interface>

View File

@ -52,7 +52,6 @@ int buildWindow() {
kona_image_meta meta;
meta.height = 100;
meta.width = 200;
meta.id = 42;
meta.image_url = "http://meow.cat/fullpic.png";
g_value_init(&sval, G_TYPE_STRING);

View File

@ -6,25 +6,17 @@ G_DEFINE_TYPE(PreviewWidget, PreviewWidget, GTK_TYPE_BIN)
// widget = PreviewWidget
// data = KonaImage
void PreviewWidget_download_clicked( GtkWidget *widget, KonaImage* ki )
void kona_download_image( GtkWidget *widget, KonaImage* ki )
{
kona_image_meta *meta;
meta = kona_image_get_meta_from_konaimage(ki);
printf("DOWNLOAD %s!\n", meta->image_url);
fflush(stdout);
//PreviewWidget_set_image(data, "/home/markus/Pictures/ba5431ccdc292f920692d17bdfc2758d.png"); // DEBUG ONLY!
}
void PreviewWidget_image_clicked( GtkWidget *widget, gint event, KonaImage* ki )
{
kona_image_meta *meta;
meta = kona_image_get_meta_from_konaimage(ki);
printf("IMAGE CLICKED: %d\n", meta->id);
fflush(stdout);
}
void PreviewWidget_set_image(PreviewWidget *widget, gchar *url) {
int height, width;
float iheight, iwidth;
@ -101,19 +93,17 @@ 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 = GTK_WIDGET(gtk_builder_get_object(builder, "evBox"));;
gtk_widget_set_events (GTK_WIDGET(klass->evBox), GDK_DOUBLE_BUTTON_PRESS); // TODO: Does not work
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"));
//gdk_window_set_cursor(gtk_widget_get_window(klass->evBox), GDK_HAND1); // TODO: Does not work
g_object_unref(G_OBJECT(builder));
}
@ -125,8 +115,8 @@ GtkWidget *PreviewWidget_new(KonaImage* ki)
g_signal_connect_swapped(ki, "notify::meta", (GCallback)previewImage_update_meta_from_konaImage, w);
// Connect UI handlers
g_signal_connect(w->button, "clicked", (GCallback)PreviewWidget_download_clicked, ki);
g_signal_connect(w->evBox, "button_press_event", (GCallback)PreviewWidget_image_clicked, ki); // TODO: Click event foo here
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

@ -1,13 +0,0 @@
aux_source_directory(. SRC_LIST)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_LIBSOUP REQUIRED libsoup-2.4)
include_directories(${PC_LIBSOUP_INCLUDE_DIRS} ../libkonaclient)
link_directories(${GTK3_LIBRARY_DIRS} ${PC_LIBSOUP_LIBRARY_DIRS} libkonaclient)
add_definitions(${GTK3_CFLAGS_OTHER})
add_executable(libkonaclient-test ${SRC_LIST})
# Link the target to the GTK+ libraries
target_link_libraries(libkonaclient-test ${PC_LIBSOUP_LIBRARIES} konaclient)

View File

@ -1,7 +0,0 @@
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
return 0;
}