Skip to content

Commit c5e9e7a

Browse files
committed
Merge pull request #4 from DerDakon/oldpatches
A bunch of minor patches
2 parents cc4e0d4 + a3a066f commit c5e9e7a

File tree

12 files changed

+31
-15
lines changed

12 files changed

+31
-15
lines changed

src/area_edit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#ifndef AREA_EDIT_H
2121
#define AREA_EDIT_H
2222

23+
#include "appdata.h"
24+
#include "pos.h"
25+
#include "settings.h"
26+
2327
typedef struct {
2428
appdata_t *appdata;
2529
GtkWidget *parent; /* parent widget to be placed upon */

src/gps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ gpointer gps_thread(gpointer data) {
340340
if(vfs_result == GNOME_VFS_OK) {
341341
str[bytes_read] = 0;
342342

343-
printf("msg: %s (%d)\n", str, strlen(str));
343+
printf("msg: %s (%zi)\n", str, strlen(str));
344344

345345
g_mutex_lock(appdata->gps_state->mutex);
346346

src/icon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void icon_free(icon_t **icon, GdkPixbuf *buf) {
9393
// printf("freeing unused icon %s\n", (*icon)->name);
9494

9595
g_free((*icon)->name);
96-
gdk_pixbuf_unref((*icon)->buf);
96+
g_object_unref((*icon)->buf);
9797
icon_t *next = (*icon)->next;
9898
g_free(*icon);
9999
*icon = next;
@@ -118,7 +118,7 @@ void icon_free_all(icon_t **icons) {
118118
while(icon) {
119119
cnt++;
120120
g_free(icon->name);
121-
gdk_pixbuf_unref(icon->buf);
121+
g_object_unref(icon->buf);
122122
icon_t *next = icon->next;
123123
g_free(icon);
124124
icon = next;

src/info.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void on_tag_edit(GtkWidget *button, tag_context_t *context) {
190190
static void on_tag_last(GtkWidget *button, tag_context_t *context) {
191191
static const char *type_name[] = { "illegal", "node", "way", "relation" };
192192

193-
if(yes_no_f(context->dialog,
193+
if(!*context->tag || yes_no_f(context->dialog,
194194
context->appdata, MISC_AGAIN_ID_OVERWRITE_TAGS, 0,
195195
_("Overwrite tags?"),
196196
_("This will overwrite all tags of this %s with the "
@@ -206,6 +206,11 @@ static void on_tag_last(GtkWidget *button, tag_context_t *context) {
206206
*context->tag = osm_tags_copy(context->appdata->map->last_way_tags);
207207

208208
info_tags_replace(context);
209+
210+
// Adding those tags above will usually make the first of the newly
211+
// added tags selected. Enable edit/remove buttons now.
212+
GtkTreeSelection *sel = list_get_selection(context->list);
213+
changed(sel, context->list);
209214
}
210215
}
211216

src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ static void
247247
cb_menu_undo_changes(GtkMenuItem *item, gpointer data) {
248248
appdata_t *appdata = (appdata_t*)data;
249249

250+
// if there is nothing to clean then don't ask
251+
if (!diff_present(appdata->project) && diff_is_clean(appdata->osm, TRUE))
252+
return;
253+
250254
if(!yes_no_f(GTK_WIDGET(appdata->window), NULL, 0, 0,
251255
_("Undo all changes?"),
252256
_("Throw away all the changes you've not "

src/map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2317,7 +2317,7 @@ static gint map_bg_item_destroy_event(GtkWidget *widget, gpointer data) {
23172317
map->bg.item = NULL;
23182318
if(map->bg.pix) {
23192319
printf("destroying background item\n");
2320-
gdk_pixbuf_unref(map->bg.pix);
2320+
g_object_unref(map->bg.pix);
23212321
map->bg.pix = NULL;
23222322
}
23232323
return FALSE;

src/map_edit.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,9 @@ void map_edit_node_move(appdata_t *appdata, map_item_t *map_item,
785785

786786
/* take all nodes from way[1] and append them to way[0] */
787787
/* check if we have to append or prepend to way[0] */
788-
gboolean reverse = FALSE;
789788
if(ways2join[0]->node_chain->node == node) {
790789
/* make "prepend" to be "append" by reversing way[0] */
791790
printf(" target prepend -> reverse\n");
792-
reverse = TRUE;
793791
osm_way_reverse(ways2join[0]);
794792
}
795793

src/net_io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ static void request_free(net_io_request_t *request) {
149149
g_free(request);
150150
}
151151

152-
static int curl_progress_func(net_io_request_t *request,
152+
static int curl_progress_func(void *req,
153153
double t, /* dltotal */ double d, /* dlnow */
154154
double ultotal, double ulnow) {
155+
net_io_request_t *request = req;
155156
request->progress = t?d/t:0;
156157
return 0;
157158
}

src/osm-gps-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ osm_gps_map_blit_tile(OsmGpsMap *map, GdkPixbuf *pixbuf, int offset_x, int offse
707707
#else
708708
#define MSG_RESPONSE_BODY(a) ((a)->response_body->data)
709709
#define MSG_RESPONSE_LEN(a) ((a)->response_body->length)
710-
#define MSG_RESPONSE_LEN_FORMAT "%lld"
710+
#define MSG_RESPONSE_LEN_FORMAT "%zu"
711711
#endif
712712

713713
#ifdef LIBSOUP22

src/osm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
12881288
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(node));
12891289
xmlNewProp(node_node, BAD_CAST "id", BAD_CAST str);
12901290
}
1291-
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(node));
1291+
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(node));
12921292
xmlNewProp(node_node, BAD_CAST "version", BAD_CAST str);
12931293
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
12941294
xmlNewProp(node_node, BAD_CAST "changeset", BAD_CAST str);
@@ -1306,7 +1306,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
13061306
xmlNodePtr way_node = xmlNewChild(root_node, NULL, BAD_CAST "way", NULL);
13071307
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(way));
13081308
xmlNewProp(way_node, BAD_CAST "id", BAD_CAST str);
1309-
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(way));
1309+
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(way));
13101310
xmlNewProp(way_node, BAD_CAST "version", BAD_CAST str);
13111311
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
13121312
xmlNewProp(way_node, BAD_CAST "changeset", BAD_CAST str);
@@ -1331,7 +1331,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
13311331
BAD_CAST "relation", NULL);
13321332
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(relation));
13331333
xmlNewProp(rel_node, BAD_CAST "id", BAD_CAST str);
1334-
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(relation));
1334+
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(relation));
13351335
xmlNewProp(rel_node, BAD_CAST "version", BAD_CAST str);
13361336
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
13371337
xmlNewProp(rel_node, BAD_CAST "changeset", BAD_CAST str);

0 commit comments

Comments
 (0)