Changeset 12
- Timestamp:
- 11/08/06 15:26:02 (2 years ago)
- Files:
-
- maemo-blog/trunk/Makefile (modified) (1 diff)
- maemo-blog/trunk/blog-metaweblog.c (modified) (4 diffs)
- maemo-blog/trunk/blog.c (modified) (3 diffs)
- maemo-blog/trunk/blog.h (modified) (2 diffs)
- maemo-blog/trunk/debian/changelog (modified) (1 diff)
- maemo-blog/trunk/gui.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
maemo-blog/trunk/Makefile
r8 r12 45 45 maemo_blog_CFLAGS += $(shell if pkg-config libgnomeui-2.0 --exists; then pkg-config libgnomeui-2.0 --cflags; echo -DHAVE_VFS_UTIL; fi) 46 46 maemo_blog_LDFLAGS += $(shell if pkg-config libgnomeui-2.0 --exists; then pkg-config libgnomeui-2.0 --libs; fi) 47 maemo_blog_CFLAGS += $(shell if pkg-config geoclue --exists; then pkg-config geoclue --cflags; echo -DGEOCLUE; fi) 48 maemo_blog_LDFLAGS += $(shell if pkg-config geoclue --exists; then pkg-config geoclue --libs; fi) 47 49 48 50 maemo_blog_CFLAGS += `pkg-config gconf-2.0 gtk+-2.0 --cflags` \ maemo-blog/trunk/blog-metaweblog.c
r10 r12 293 293 { 294 294 xmlrpc_value *array; 295 xmlrpc_value *stru; 295 296 GSList *iter; 296 297 struct BlogMetaweblogPostedClosure *clo; … … 308 309 clo->user_data = user_data; 309 310 310 array = xmlrpc_ build_value(&data->env, "()");311 array = xmlrpc_array_new(&data->env); 311 312 die_if_fault_occurred(&data->env); 312 313 … … 321 322 } 322 323 324 stru = xmlrpc_struct_new(&data->env); 325 xmlrpc_struct_set_value(&data->env, 326 stru, 327 "title", 328 xmlrpc_string_new(&data->env, post->title)); 329 xmlrpc_struct_set_value(&data->env, 330 stru, 331 "description", 332 xmlrpc_string_new(&data->env, post->content)); 333 xmlrpc_struct_set_value(&data->env, 334 stru, 335 "category", 336 array); 337 xmlrpc_struct_set_value(&data->env, 338 stru, 339 "categories", 340 array); 341 for (iter = post->extra_fields; iter; iter = iter->next) { 342 BlogParameter *parm = iter->data; 343 xmlrpc_value *value = NULL; 344 switch (G_VALUE_TYPE(&parm->value)) { 345 case G_TYPE_STRING: 346 value = xmlrpc_string_new(&data->env, 347 g_value_get_string( 348 &parm->value)); 349 break; 350 case G_TYPE_INT: 351 value = xmlrpc_int_new(&data->env, 352 g_value_get_int( 353 &parm->value)); 354 break; 355 case G_TYPE_UINT: 356 value = xmlrpc_int_new(&data->env, 357 (int)g_value_get_uint( 358 &parm->value)); 359 break; 360 case G_TYPE_BOOLEAN: 361 value = xmlrpc_bool_new(&data->env, 362 g_value_get_boolean( 363 &parm->value)); 364 break; 365 default: 366 break; 367 } 368 if (value) { 369 xmlrpc_struct_set_value(&data->env, 370 stru, 371 parm->name, 372 value); 373 } 374 } 375 323 376 xmlrpc_client_start_rpcf(&data->env, 324 377 data->client, … … 326 379 _blog_metaweblog_posted, 327 380 clo, 328 (char *)"(sss {s:s,s:s,s:V,s:V}b)",381 (char *)"(sssVb)", 329 382 blog->id, 330 383 blog->user, 331 384 blog->pass, 332 "title", 333 post->title, 334 "description", 335 post->content, 336 "category", 337 array, 338 "categories", 339 array, 385 stru, 340 386 publish); 341 387 maemo-blog/trunk/blog.c
r2 r12 1 1 #include "blog.h" 2 3 void blog_parameter_free(BlogParameter *param) 4 { 5 g_free(param->name); 6 g_value_unset(¶m->value); 7 g_free(param); 8 } 2 9 3 10 void blog_post_free(BlogPost *post) … … 6 13 g_free(post->title); 7 14 g_free(post->content); 15 g_slist_foreach(post->extra_fields, (GFunc)blog_parameter_free, NULL); 16 g_free(post); 8 17 } 9 18 … … 12 21 g_free(category->name); 13 22 g_free(category->id); 23 g_free(category); 14 24 } 15 25 maemo-blog/trunk/blog.h
r2 r12 3 3 4 4 #include <glib.h> 5 #include <glib-object.h> 5 6 6 7 typedef struct _Blog Blog; 7 8 typedef struct _BlogCategory BlogCategory; 8 9 typedef struct _BlogPost BlogPost; 10 typedef struct _BlogParameter BlogParameter; 9 11 10 12 #include "blog-plugin.h" … … 30 32 gchar *title; 31 33 GSList *categories; 34 GSList *extra_fields; 32 35 gchar *content; 33 36 }; 34 37 38 struct _BlogParameter { 39 gchar *name; 40 GValue value; 41 }; 42 43 void blog_parameter_free(BlogParameter *param); 35 44 void blog_post_free(BlogPost *post); 36 45 void blog_category_free(BlogCategory *category); maemo-blog/trunk/debian/changelog
r11 r12 1 maemo-blog (0.1.4) mistral; urgency=low 2 3 * First try for geoclue support. 4 5 -- Santtu Lakkala <inz@localhost.localdomain> Wed, 8 Nov 2006 15:25:03 +0200 6 1 7 maemo-blog (0.1.3) mistral; urgency=low 2 8 maemo-blog/trunk/gui.c
r8 r12 14 14 #ifdef HAVE_VFS_UTIL 15 15 #include <libgnomeui/gnome-vfs-util.h> 16 #endif 17 #ifdef GEOCLUE 18 #include <geoclue/position.h> 16 19 #endif 17 20 #include "blog-plugin.h" … … 254 257 gtk_widget_destroy(dialog); 255 258 } 259 260 #ifdef GEOCLUE 261 static void _geo(GObject *object, GObject *window) 262 { 263 gdouble lat, lon; 264 265 (void)object; 266 267 geoclue_position_init(); 268 geoclue_position_current_position(&lat, &lon); 269 g_object_set_data_full(window, "position", 270 g_strdup_printf("%f %f", lat, lon), 271 g_free); 272 fprintf(stderr, "Position now: %s\n", (gchar *)g_object_get_data(window, "position")); 273 } 274 #endif 256 275 257 276 static void _send(GObject *object, GObject *window) … … 282 301 gchar *pos; 283 302 guint image_count, i; 303 gchar *position = g_object_get_data(window, "position"); 284 304 285 305 (void)object; … … 376 396 g_slist_append(post->categories, category); 377 397 } 398 } 399 400 if (position) { 401 BlogParameter *parm = g_new0(BlogParameter, 1); 402 403 parm->name = g_strdup("georss:point"); 404 g_value_init(&parm->value, G_TYPE_STRING); 405 g_value_set_string(&parm->value, position); 406 post->extra_fields = g_slist_append(post->extra_fields, 407 parm); 378 408 } 379 409 … … 1007 1037 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); 1008 1038 g_signal_connect(button, "clicked", G_CALLBACK(_img), gtk_text_view_get_buffer(GTK_TEXT_VIEW(view))); 1039 #ifdef GEOCLUE 1040 button = gtk_tool_button_new(NULL, "Geo"); 1041 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); 1042 g_signal_connect(button, "clicked", G_CALLBACK(_geo), window); 1043 #endif 1009 1044 #ifdef HILDON 1010 1045 button = gtk_toggle_tool_button_new();
