void social_add_bookmark (const itemPtr item) { gchar *link = item_make_link (item); gchar *url = social_get_bookmark_url (link, item_get_title (item)); (void)browser_tabs_add_new (url, social_get_bookmark_site(), TRUE); g_free (link); g_free (url); }
void liferea_htmlview_prepare_context_menu (LifereaHtmlView *htmlview, GtkMenu *menu, const gchar *linkUri, const gchar *imageUri) { GList *item, *items; gboolean link = (linkUri != NULL); gboolean image = (imageUri != NULL); /* first drop all menu items that are provided by the browser widget (necessary for WebKit) */ item = items = gtk_container_get_children (GTK_CONTAINER (menu)); while (item) { gtk_widget_destroy (GTK_WIDGET (item->data)); item = g_list_next (item); } g_list_free (items); /* do not expose internal links */ if (linkUri && liferea_htmlview_is_special_url (linkUri) && !g_str_has_prefix (linkUri, "javascript:") && !g_str_has_prefix (linkUri, "data:")) link = FALSE; /* and now add all we want to see */ if (link) { gchar *path; menu_add_option (menu, _("Open Link In _Tab"), NULL, G_CALLBACK (on_popup_open_link_in_tab_activate), (gpointer)linkUri); menu_add_option (menu, _("_Open Link In Browser"), NULL, G_CALLBACK (on_popup_launch_link_activate), (gpointer)linkUri); menu_add_option (menu, _("_Open Link In External Browser"), NULL, G_CALLBACK (on_popup_launch_link_external_activate), (gpointer)linkUri); menu_add_separator (menu); path = g_strdup_printf (_("_Bookmark Link at %s"), social_get_bookmark_site ()); menu_add_option (menu, path, NULL, on_popup_social_bm_link_activate, (gpointer)linkUri); g_free (path); menu_add_option (menu, _("_Copy Link Location"), "gtk-copy", G_CALLBACK (on_popup_copy_url_activate), (gpointer)linkUri); } if (image) menu_add_option (menu, _("_Copy Image Location"), "gtk-copy", G_CALLBACK (on_popup_copy_url_activate), (gpointer)imageUri); if (link) menu_add_option (menu, _("S_ave Link As"), "gtk-save", G_CALLBACK (on_popup_save_url_activate), (gpointer)linkUri); if (image) menu_add_option (menu, _("S_ave Image As"), "gtk-save", G_CALLBACK (on_popup_save_url_activate), (gpointer)imageUri); if (link) { menu_add_separator (menu); menu_add_option (menu, _("_Subscribe..."), "gtk-add", G_CALLBACK (on_popup_subscribe_url_activate), (gpointer)linkUri); } if(!link && !image) { GtkWidget *item; item = menu_add_option (menu, NULL, GTK_STOCK_COPY, G_CALLBACK (on_popup_copy_activate), htmlview); if (!(RENDERER (htmlview)->hasSelection) (htmlview->priv->renderWidget)) gtk_widget_set_sensitive (item, FALSE); menu_add_separator (menu); menu_add_option (menu, _("_Increase Text Size"), "gtk-zoom-in", G_CALLBACK (on_popup_zoomin_activate), htmlview); menu_add_option (menu, _("_Decrease Text Size"), "gtk-zoom-out", G_CALLBACK (on_popup_zoomout_activate), htmlview); } }