Mercurial > geeqie.yaz
comparison src/ui_bookmark.c @ 442:4b2d7f9af171
Big whitespaces cleanup:
- drop whitespaces at end of lines
- convert eight spaces to tab at start of lines
- drop spurious spaces mixed with tabs
- remove empty lines at end of files
author | zas_ |
---|---|
date | Sun, 20 Apr 2008 13:04:57 +0000 |
parents | 2649a28d31b6 |
children | ddabc4873a3f |
comparison
equal
deleted
inserted
replaced
441:08eb7137cd94 | 442:4b2d7f9af171 |
---|---|
506 | 506 |
507 if (icon) | 507 if (icon) |
508 { | 508 { |
509 return g_strdup_printf("%s"MARKER_PATH"%s"MARKER_ICON"%s", name, path, icon); | 509 return g_strdup_printf("%s"MARKER_PATH"%s"MARKER_ICON"%s", name, path, icon); |
510 } | 510 } |
511 | 511 |
512 return g_strdup_printf("%s"MARKER_PATH"%s", name, path); | 512 return g_strdup_printf("%s"MARKER_PATH"%s", name, path); |
513 } | 513 } |
514 | 514 |
515 static void bookmark_select_cb(GtkWidget *button, gpointer data) | 515 static void bookmark_select_cb(GtkWidget *button, gpointer data) |
516 { | 516 { |
574 BookPropData *p; | 574 BookPropData *p; |
575 GenericDialog *gd; | 575 GenericDialog *gd; |
576 GtkWidget *table; | 576 GtkWidget *table; |
577 GtkWidget *label; | 577 GtkWidget *label; |
578 const gchar *icon; | 578 const gchar *icon; |
579 | 579 |
580 if (!key) key = "bookmarks"; | 580 if (!key) key = "bookmarks"; |
581 | 581 |
582 p = g_new0(BookPropData, 1); | 582 p = g_new0(BookPropData, 1); |
583 | 583 |
584 p->bb = bookmark_from_string(text); | 584 p->bb = bookmark_from_string(text); |
617 pref_table_label(table, 0, 2, _("Icon:"), 1.0); | 617 pref_table_label(table, 0, 2, _("Icon:"), 1.0); |
618 | 618 |
619 icon = p->bb->icon; | 619 icon = p->bb->icon; |
620 if (!icon) icon = ""; | 620 if (!icon) icon = ""; |
621 label = tab_completion_new_with_history(&p->icon_entry, icon, | 621 label = tab_completion_new_with_history(&p->icon_entry, icon, |
622 "bookmark_icons", -1, NULL, NULL); | 622 "bookmark_icons", -1, NULL, NULL); |
623 tab_completion_add_select_button(p->icon_entry, _("Select icon"), FALSE); | 623 tab_completion_add_select_button(p->icon_entry, _("Select icon"), FALSE); |
624 gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3); | 624 gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3); |
625 generic_dialog_attach_default(gd, p->icon_entry); | 625 generic_dialog_attach_default(gd, p->icon_entry); |
626 gtk_widget_show(label); | 626 gtk_widget_show(label); |
627 | 627 |
682 } | 682 } |
683 | 683 |
684 static void bookmark_menu_remove_cb(GtkWidget *widget, gpointer data) | 684 static void bookmark_menu_remove_cb(GtkWidget *widget, gpointer data) |
685 { | 685 { |
686 BookMarkData *bm = data; | 686 BookMarkData *bm = data; |
687 | 687 |
688 if (!bm->active_button) return; | 688 if (!bm->active_button) return; |
689 | 689 |
690 history_list_item_remove(bm->key, bm->active_button->key); | 690 history_list_item_remove(bm->key, bm->active_button->key); |
691 bookmark_populate_all(bm->key); | 691 bookmark_populate_all(bm->key); |
692 } | 692 } |
736 BookMarkData *bm = data; | 736 BookMarkData *bm = data; |
737 | 737 |
738 if (event->button != 3) return FALSE; | 738 if (event->button != 3) return FALSE; |
739 | 739 |
740 bookmark_menu_popup(bm, button, event->button, event->time, FALSE); | 740 bookmark_menu_popup(bm, button, event->button, event->time, FALSE); |
741 | 741 |
742 return TRUE; | 742 return TRUE; |
743 } | 743 } |
744 | 744 |
745 static gint bookmark_keypress_cb(GtkWidget *button, GdkEventKey *event, gpointer data) | 745 static gint bookmark_keypress_cb(GtkWidget *button, GdkEventKey *event, gpointer data) |
746 { | 746 { |
785 | 785 |
786 if (context->dest_window == bm->widget->window) return; | 786 if (context->dest_window == bm->widget->window) return; |
787 | 787 |
788 b = g_object_get_data(G_OBJECT(button), "bookbuttondata"); | 788 b = g_object_get_data(G_OBJECT(button), "bookbuttondata"); |
789 if (!b) return; | 789 if (!b) return; |
790 | 790 |
791 list = g_list_append(list, b->path); | 791 list = g_list_append(list, b->path); |
792 | 792 |
793 switch (info) | 793 switch (info) |
794 { | 794 { |
795 case TARGET_URI_LIST: | 795 case TARGET_URI_LIST: |
814 GdkPixbuf *pixbuf; | 814 GdkPixbuf *pixbuf; |
815 GdkModifierType mask; | 815 GdkModifierType mask; |
816 gint x, y; | 816 gint x, y; |
817 | 817 |
818 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, | 818 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, |
819 button->allocation.width, button->allocation.height); | 819 button->allocation.width, button->allocation.height); |
820 gdk_pixbuf_get_from_drawable(pixbuf, button->window, NULL, | 820 gdk_pixbuf_get_from_drawable(pixbuf, button->window, NULL, |
821 button->allocation.x, button->allocation.y, | 821 button->allocation.x, button->allocation.y, |
822 0, 0, button->allocation.width, button->allocation.height); | 822 0, 0, button->allocation.width, button->allocation.height); |
823 | 823 |
824 gdk_window_get_pointer(button->window, &x, &y, &mask); | 824 gdk_window_get_pointer(button->window, &x, &y, &mask); |
825 | 825 |
826 gtk_drag_set_icon_pixbuf(context, pixbuf, | 826 gtk_drag_set_icon_pixbuf(context, pixbuf, |
827 x - button->allocation.x, y - button->allocation.y); | 827 x - button->allocation.x, y - button->allocation.y); |
828 g_object_unref(pixbuf); | 828 g_object_unref(pixbuf); |
829 } | 829 } |
830 | 830 |
831 static void bookmark_populate(BookMarkData *bm) | 831 static void bookmark_populate(BookMarkData *bm) |
832 { | 832 { |
833 GtkBox *box; | 833 GtkBox *box; |
834 GList *work; | 834 GList *work; |
835 GList *children; | 835 GList *children; |
836 | 836 |
837 box = GTK_BOX(bm->box); | 837 box = GTK_BOX(bm->box); |
838 children = gtk_container_get_children(GTK_CONTAINER(box)); | 838 children = gtk_container_get_children(GTK_CONTAINER(box)); |
839 work = children; | 839 work = children; |
840 while (work) | 840 while (work) |
841 { | 841 { |
867 | 867 |
868 work = bookmark_default_list; | 868 work = bookmark_default_list; |
869 while (work && work->next) | 869 while (work && work->next) |
870 { | 870 { |
871 gchar *name; | 871 gchar *name; |
872 | 872 |
873 name = work->data; | 873 name = work->data; |
874 work = work->next; | 874 work = work->next; |
875 path = work->data; | 875 path = work->data; |
876 work = work->next; | 876 work = work->next; |
877 | 877 |
927 g_object_unref(pixbuf); | 927 g_object_unref(pixbuf); |
928 } | 928 } |
929 else | 929 else |
930 { | 930 { |
931 b->image = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, | 931 b->image = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, |
932 GTK_ICON_SIZE_BUTTON); | 932 GTK_ICON_SIZE_BUTTON); |
933 } | 933 } |
934 } | 934 } |
935 else | 935 else |
936 { | 936 { |
937 b->image = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON); | 937 b->image = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON); |
964 } | 964 } |
965 | 965 |
966 static void bookmark_populate_all(const gchar *key) | 966 static void bookmark_populate_all(const gchar *key) |
967 { | 967 { |
968 GList *work; | 968 GList *work; |
969 | 969 |
970 if (!key) return; | 970 if (!key) return; |
971 | 971 |
972 work = bookmark_widget_list; | 972 work = bookmark_widget_list; |
973 while (work) | 973 while (work) |
974 { | 974 { |
975 BookMarkData *bm; | 975 BookMarkData *bm; |
976 | 976 |
1034 GtkWidget *bookmark_list_new(const gchar *key, | 1034 GtkWidget *bookmark_list_new(const gchar *key, |
1035 void (*select_func)(const gchar *path, gpointer data), gpointer select_data) | 1035 void (*select_func)(const gchar *path, gpointer data), gpointer select_data) |
1036 { | 1036 { |
1037 GtkWidget *scrolled; | 1037 GtkWidget *scrolled; |
1038 BookMarkData *bm; | 1038 BookMarkData *bm; |
1039 | 1039 |
1040 if (!key) key = "bookmarks"; | 1040 if (!key) key = "bookmarks"; |
1041 | 1041 |
1042 bm = g_new0(BookMarkData, 1); | 1042 bm = g_new0(BookMarkData, 1); |
1043 bm->key = g_strdup(key); | 1043 bm->key = g_strdup(key); |
1044 | 1044 |
1260 /* the following characters are allowed to be unencoded for pathnames: | 1260 /* the following characters are allowed to be unencoded for pathnames: |
1261 * $ & + , / : = @ | 1261 * $ & + , / : = @ |
1262 */ | 1262 */ |
1263 static gint escape_char_list[] = { | 1263 static gint escape_char_list[] = { |
1264 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0 */ | 1264 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0 */ |
1265 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 */ | 1265 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 */ |
1266 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 */ | 1266 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 */ |
1267 /* spc ! " # $ % & ' */ | 1267 /* spc ! " # $ % & ' */ |
1268 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, /* 30 */ | 1268 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, /* 30 */ |
1269 /* ( ) * + , - . / 0 1 */ | 1269 /* ( ) * + , - . / 0 1 */ |
1270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 */ | 1270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 */ |
1307 GString *string; | 1307 GString *string; |
1308 gchar *result; | 1308 gchar *result; |
1309 const gchar *p; | 1309 const gchar *p; |
1310 | 1310 |
1311 if (!text) return NULL; | 1311 if (!text) return NULL; |
1312 | 1312 |
1313 string = g_string_new(""); | 1313 string = g_string_new(""); |
1314 | 1314 |
1315 p = text; | 1315 p = text; |
1316 while (*p != '\0') | 1316 while (*p != '\0') |
1317 { | 1317 { |