mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 13:37:02 +03:00
Add hotlist favourites star button
This commit is contained in:
parent
24d0916778
commit
50e038538a
@ -772,6 +772,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
|
||||
|
||||
hotlist_add_url(url);
|
||||
nsurl_unref(url);
|
||||
ami_gui_update_hotlist_button(gwin);
|
||||
}
|
||||
break;
|
||||
|
||||
|
90
amiga/gui.c
90
amiga/gui.c
@ -20,6 +20,7 @@
|
||||
#include "content/urldb.h"
|
||||
#include "css/utils.h"
|
||||
#include "desktop/browser_private.h"
|
||||
#include "desktop/hotlist.h"
|
||||
#include "desktop/local_history.h"
|
||||
#include "desktop/mouse.h"
|
||||
#include "desktop/netsurf.h"
|
||||
@ -544,9 +545,6 @@ static nserror ami_set_options(struct nsoption_s *defaults)
|
||||
nsoption_setnull_charp(url_file,
|
||||
(char *)strdup(temp));
|
||||
|
||||
/* devs:curl-ca-bundle.crt is the default place for the ca bundle on OS4,
|
||||
* but we can't rely on it existing, so default to our local one in resources */
|
||||
|
||||
nsoption_setnull_charp(ca_bundle,
|
||||
(char *)strdup("PROGDIR:Resources/ca-bundle"));
|
||||
|
||||
@ -2799,6 +2797,31 @@ void gui_quit(void)
|
||||
FreeVec(current_user);
|
||||
}
|
||||
|
||||
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
|
||||
{
|
||||
char image[100];
|
||||
char *url;
|
||||
nsurl *nsurl;
|
||||
|
||||
GetAttr(STRINGA_TextVal,
|
||||
(Object *)gwin->objects[GID_URL],
|
||||
(ULONG *)&url);
|
||||
|
||||
if(nsurl_create(url, &nsurl) == NSERROR_OK) {
|
||||
if(hotlist_has_url(nsurl)) {
|
||||
ami_get_theme_filename(image, "theme_unfave", false);
|
||||
} else {
|
||||
ami_get_theme_filename(image, "theme_fave", false);
|
||||
}
|
||||
|
||||
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FAVEIMG],
|
||||
gwin->win, NULL, BITMAP_SourceFile, image, TAG_DONE);
|
||||
|
||||
nsurl_unref(nsurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ami_update_buttons(struct gui_window_2 *gwin)
|
||||
{
|
||||
BOOL back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
|
||||
@ -3121,6 +3144,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
char home[100],home_s[100],home_g[100];
|
||||
char closetab[100],closetab_s[100],closetab_g[100];
|
||||
char addtab[100],addtab_s[100],addtab_g[100];
|
||||
char fave[100];
|
||||
char tabthrobber[100];
|
||||
ULONG refresh_mode = WA_SmartRefresh;
|
||||
ULONG idcmp_sizeverify = IDCMP_SIZEVERIFY;
|
||||
@ -3283,28 +3307,29 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
g->shared->helphints[GID_ADDTAB] =
|
||||
translate_escape_chars(messages_get("HelpToolbarAddTab"));
|
||||
|
||||
ami_get_theme_filename(nav_west,"theme_nav_west",false);
|
||||
ami_get_theme_filename(nav_west_s,"theme_nav_west_s",false);
|
||||
ami_get_theme_filename(nav_west_g,"theme_nav_west_g",false);
|
||||
ami_get_theme_filename(nav_east,"theme_nav_east",false);
|
||||
ami_get_theme_filename(nav_east_s,"theme_nav_east_s",false);
|
||||
ami_get_theme_filename(nav_east_g,"theme_nav_east_g",false);
|
||||
ami_get_theme_filename(stop,"theme_stop",false);
|
||||
ami_get_theme_filename(stop_s,"theme_stop_s",false);
|
||||
ami_get_theme_filename(stop_g,"theme_stop_g",false);
|
||||
ami_get_theme_filename(reload,"theme_reload",false);
|
||||
ami_get_theme_filename(reload_s,"theme_reload_s",false);
|
||||
ami_get_theme_filename(reload_g,"theme_reload_g",false);
|
||||
ami_get_theme_filename(home,"theme_home",false);
|
||||
ami_get_theme_filename(home_s,"theme_home_s",false);
|
||||
ami_get_theme_filename(home_g,"theme_home_g",false);
|
||||
ami_get_theme_filename(closetab,"theme_closetab",false);
|
||||
ami_get_theme_filename(closetab_s,"theme_closetab_s",false);
|
||||
ami_get_theme_filename(closetab_g,"theme_closetab_g",false);
|
||||
ami_get_theme_filename(addtab,"theme_addtab",false);
|
||||
ami_get_theme_filename(addtab_s,"theme_addtab_s",false);
|
||||
ami_get_theme_filename(addtab_g,"theme_addtab_g",false);
|
||||
ami_get_theme_filename(tabthrobber,"theme_tab_loading",false);
|
||||
ami_get_theme_filename(nav_west, "theme_nav_west", false);
|
||||
ami_get_theme_filename(nav_west_s, "theme_nav_west_s", false);
|
||||
ami_get_theme_filename(nav_west_g, "theme_nav_west_g", false);
|
||||
ami_get_theme_filename(nav_east, "theme_nav_east", false);
|
||||
ami_get_theme_filename(nav_east_s, "theme_nav_east_s", false);
|
||||
ami_get_theme_filename(nav_east_g, "theme_nav_east_g", false);
|
||||
ami_get_theme_filename(stop, "theme_stop", false);
|
||||
ami_get_theme_filename(stop_s, "theme_stop_s", false);
|
||||
ami_get_theme_filename(stop_g, "theme_stop_g", false);
|
||||
ami_get_theme_filename(reload, "theme_reload", false);
|
||||
ami_get_theme_filename(reload_s, "theme_reload_s", false);
|
||||
ami_get_theme_filename(reload_g, "theme_reload_g", false);
|
||||
ami_get_theme_filename(home, "theme_home", false);
|
||||
ami_get_theme_filename(home_s, "theme_home_s", false);
|
||||
ami_get_theme_filename(home_g, "theme_home_g", false);
|
||||
ami_get_theme_filename(closetab, "theme_closetab", false);
|
||||
ami_get_theme_filename(closetab_s, "theme_closetab_s", false);
|
||||
ami_get_theme_filename(closetab_g, "theme_closetab_g", false);
|
||||
ami_get_theme_filename(addtab, "theme_addtab", false);
|
||||
ami_get_theme_filename(addtab_s, "theme_addtab_s", false);
|
||||
ami_get_theme_filename(addtab_g, "theme_addtab_g", false);
|
||||
ami_get_theme_filename(tabthrobber, "theme_tab_loading", false);
|
||||
ami_get_theme_filename(fave, "theme_fave", false);
|
||||
|
||||
g->shared->objects[GID_ADDTAB_BM] = BitMapObject,
|
||||
BITMAP_SourceFile, addtab,
|
||||
@ -3484,6 +3509,20 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
STRINGVIEW_Header, URLHistory_GetList(),
|
||||
StringEnd,
|
||||
|
||||
LAYOUT_AddChild, g->shared->objects[GID_FAVE] = ButtonObject,
|
||||
GA_ID, GID_FAVE,
|
||||
GA_RelVerify, TRUE,
|
||||
// GA_HintInfo, g->shared->helphints[GID_FAVE],
|
||||
BUTTON_RenderImage, g->shared->objects[GID_FAVEIMG] = BitMapObject,
|
||||
BITMAP_SourceFile, fave,
|
||||
// BITMAP_SelectSourceFile, fave_s,
|
||||
BITMAP_Screen, scrn,
|
||||
BITMAP_Masking, TRUE,
|
||||
BitMapEnd,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
|
||||
// GA_ID, GID_TOOLBARLAYOUT,
|
||||
// GA_RelVerify, TRUE,
|
||||
// LAYOUT_RelVerify, TRUE,
|
||||
@ -4835,6 +4874,7 @@ void gui_window_new_content(struct gui_window *g)
|
||||
g->favicon = NULL;
|
||||
ami_plot_release_pens(&g->shared->shared_pens);
|
||||
ami_menu_update_disabled(g, c);
|
||||
ami_gui_update_hotlist_button(g->shared);
|
||||
}
|
||||
|
||||
bool gui_window_scroll_start(struct gui_window *g)
|
||||
|
@ -48,6 +48,8 @@ enum
|
||||
GID_FORWARD,
|
||||
GID_THROBBER,
|
||||
GID_SEARCH_ICON,
|
||||
GID_FAVE,
|
||||
GID_FAVEIMG,
|
||||
GID_CLOSETAB,
|
||||
GID_CLOSETAB_BM,
|
||||
GID_ADDTAB,
|
||||
@ -160,6 +162,7 @@ void ami_gui_history(struct gui_window_2 *gwin, bool back);
|
||||
void ami_gui_hotlist_toolbar_update_all(void);
|
||||
void ami_gui_tabs_toggle_all(void);
|
||||
bool ami_locate_resource(char *fullpath, const char *file);
|
||||
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
|
||||
|
||||
struct TextFont *origrpfont;
|
||||
struct MinList *window_list;
|
||||
|
@ -1030,6 +1030,7 @@ static void ami_menu_item_hotlist_add(struct Hook *hook, APTR window, struct Int
|
||||
return;
|
||||
|
||||
hotlist_add_url(hlcache_handle_get_url(bw->current_content));
|
||||
ami_gui_update_hotlist_button(gwin);
|
||||
}
|
||||
|
||||
static void ami_menu_item_hotlist_show(struct Hook *hook, APTR window, struct IntuiMessage *msg)
|
||||
|
@ -29,6 +29,8 @@ theme_throbber_frames:13
|
||||
theme_throbber_delay:100
|
||||
theme_tab_loading:*TBImages:list_download
|
||||
theme_search:*TBImages:list_search
|
||||
theme_fave:*TBImages:list_favourite
|
||||
theme_unfave:*TBImages:list_favouriteadd
|
||||
ptr_default:*PROGDIR:Resources/Pointers/Default
|
||||
ptr_point:*PROGDIR:Resources/Pointers/Point
|
||||
ptr_caret:*PROGDIR:Resources/Pointers/Caret
|
||||
|
@ -42,6 +42,8 @@ theme_throbber_frames:9
|
||||
theme_throbber_delay:100
|
||||
theme_tab_loading:
|
||||
theme_search:search.png
|
||||
theme_fave:*PROGDIR:Resources/icons/hotlist-add.png
|
||||
theme_fave:*PROGDIR:Resources/icons/hotlist-rmv.png
|
||||
ptr_default:*PROGDIR:Resources/Pointers/Default
|
||||
ptr_point:*PROGDIR:Resources/Pointers/Point
|
||||
ptr_caret:*PROGDIR:Resources/Pointers/Caret
|
||||
|
Loading…
Reference in New Issue
Block a user