View | Details | Raw Unified | Return to bug 349604
Collapse All | Expand All

(-)libslab/bookmark-agent.c (-13 / +39 lines)
Lines 590-595 Link Here
590
	gint       rank_corr       = -1;
590
	gint       rank_corr       = -1;
591
	gboolean   needs_update    = FALSE;
591
	gboolean   needs_update    = FALSE;
592
	gboolean   store_corrupted = FALSE;
592
	gboolean   store_corrupted = FALSE;
593
	gchar     *new_title, *old_title;
593
594
594
	gint i;
595
	gint i;
595
596
Lines 625-633 Link Here
625
	if (priv->n_items != n_uris)
626
	if (priv->n_items != n_uris)
626
		needs_update = TRUE;
627
		needs_update = TRUE;
627
628
628
	for (i = 0; ! needs_update && uris_ordered && uris_ordered [i]; ++i)
629
	for (i = 0; ! needs_update && uris_ordered && uris_ordered [i]; ++i) {
629
		if (strcmp (priv->items [i]->uri, uris_ordered [i]))
630
		if (priv->type == BOOKMARK_STORE_USER_DIRS) {
631
			new_title = g_bookmark_file_get_title (priv->store, uris_ordered [i], NULL);
632
			old_title = priv->items [i]->title;
633
			if (!new_title && !old_title) {
634
				if (strcmp (priv->items [i]->uri, uris_ordered [i]))
635
					needs_update = TRUE;
636
			}
637
			else if ((new_title && !old_title) || (!new_title && old_title))
638
				needs_update = TRUE;
639
			else if (strcmp (old_title, new_title))
640
				needs_update = TRUE;
641
			g_free (new_title);
642
		}
643
		else if (strcmp (priv->items [i]->uri, uris_ordered [i]))
630
			needs_update = TRUE;
644
			needs_update = TRUE;
645
	}
631
646
632
	if (needs_update) {
647
	if (needs_update) {
633
		for (i = 0; priv->items && priv->items [i]; ++i)
648
		for (i = 0; priv->items && priv->items [i]; ++i)
Lines 777-789 Link Here
777
792
778
	gchar **uris;
793
	gchar **uris;
779
	gchar **groups;
794
	gchar **groups;
780
	gchar **folders = NULL;
795
	gchar **bookmarks = NULL;
796
	
797
	gchar  *buf, *label, *uri;
781
798
782
	gchar  *buf;
799
	gint i, j, bookmark_len;
783
800
784
	gint i, j;
785
786
787
	load_xbel_store (this);
801
	load_xbel_store (this);
788
802
789
	uris = g_bookmark_file_get_uris (priv->store, NULL);
803
	uris = g_bookmark_file_get_uris (priv->store, NULL);
Lines 807-824 Link Here
807
	g_file_get_contents (priv->gtk_store_path, & buf, NULL, NULL);
821
	g_file_get_contents (priv->gtk_store_path, & buf, NULL, NULL);
808
822
809
	if (buf) {
823
	if (buf) {
810
		folders = g_strsplit (buf, "\n", -1);
824
		bookmarks = g_strsplit (buf, "\n", -1);
811
		g_free (buf);
825
		g_free (buf);
812
	}
826
	}
813
827
814
	for (i = 0; folders && folders [i]; ++i) {
828
	for (i = 0; bookmarks && bookmarks [i]; ++i) {
815
		if (strlen (folders [i]) > 0) {
829
		bookmark_len = strlen (bookmarks [i]);
816
			g_bookmark_file_add_group (priv->store, folders [i], "gtk-bookmarks");
830
		if (bookmark_len > 0) {
817
			priv->create_item (this, folders [i]);
831
			label = strstr (bookmarks[i], " ");
832
			if (label != NULL)
833
				uri = g_strndup (bookmarks [i], bookmark_len - strlen (label));
834
			else
835
				uri = bookmarks [i];
836
			g_bookmark_file_add_group (priv->store, uri, "gtk-bookmarks");
837
			priv->create_item (this, uri);
838
			if (label != NULL) {
839
				label++;
840
				if (strlen (label) > 0)
841
					g_bookmark_file_set_title (priv->store, uri, label);
842
				g_free (uri);
843
			}
818
		}
844
		}
819
	}
845
	}
820
846
821
	g_strfreev (folders);
847
	g_strfreev (bookmarks);
822
}
848
}
823
849
824
static void
850
static void

Return to bug 349604