Back to index

lightning-sunbird  0.9+nobinonly
Functions
minimo_context.h File Reference
#include "minimo_types.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void on_menu_destroy (GtkWidget *menu, gchar *name)
GtkWidget * get_link_popup_menu (MinimoBrowser *browser, gchar *href, gchar *linktext)
GtkWidget * get_image_popup_menu (MinimoBrowser *browser, gchar *img)
GtkWidget * get_doc_popup_menu (MinimoBrowser *browser, gchar *href)
GtkWidget * get_link_image_popup_menu (MinimoBrowser *browser, gchar *img, gchar *href)

Function Documentation

GtkWidget* get_doc_popup_menu ( MinimoBrowser browser,
gchar *  href 
)

Definition at line 178 of file minimo_context.cpp.

{
  GtkWidget *menu, *m1,*m2,*m3, *m4, *m5, *m6, *sep;
  
  if (browser->doc_menu) gtk_widget_destroy(browser->doc_menu);
  menu = gtk_menu_new();
  g_object_set_data(G_OBJECT(menu), "freehref", href);
  
  m1 =  gtk_image_menu_item_new_from_stock(GTK_STOCK_GO_BACK,NULL);
  g_signal_connect(G_OBJECT(m1), "activate", G_CALLBACK(back_clicked_cb), browser);
  gtk_widget_set_sensitive(m1, gtk_moz_embed_can_go_back(GTK_MOZ_EMBED(browser->mozEmbed)));
  gtk_menu_append(GTK_MENU(menu), m1);
  
  m2 = gtk_image_menu_item_new_from_stock(GTK_STOCK_GO_FORWARD,NULL);
  gtk_menu_append(GTK_MENU(menu), m2);
  g_signal_connect(G_OBJECT(m2), "activate", G_CALLBACK(forward_clicked_cb), browser);
  gtk_widget_set_sensitive(m2, gtk_moz_embed_can_go_forward(GTK_MOZ_EMBED(browser->mozEmbed)));
  
  m3  = gtk_image_menu_item_new_from_stock(GTK_STOCK_REFRESH,NULL);     
  g_signal_connect(G_OBJECT(m3), "activate", G_CALLBACK(reload_clicked_cb), browser);
  gtk_menu_append(GTK_MENU(menu), m3);
  
  m4 = gtk_image_menu_item_new_from_stock(GTK_STOCK_STOP,NULL);
  g_signal_connect(G_OBJECT(m4), "activate", G_CALLBACK(stop_clicked_cb), browser);
  gtk_menu_append(GTK_MENU(menu), m4);
  
  /* Separator */
  sep = gtk_menu_item_new();
  gtk_menu_append(GTK_MENU(menu), sep);
  
  m5 = gtk_image_menu_item_new_with_mnemonic ("_Save page as ... ");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m5),
                                gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m5), "activate", G_CALLBACK(download_link_from_popup), browser);
  g_object_set_data(G_OBJECT(m5), "link", gtk_moz_embed_get_location(GTK_MOZ_EMBED (browser->mozEmbed)));
  gtk_menu_append(GTK_MENU(menu), m5);
  
  m6 = gtk_image_menu_item_new_with_mnemonic ("_Bookmark this page");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m6),
                                gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m6), "activate", G_CALLBACK(add_bookmark_cb), browser);
  gtk_menu_append(GTK_MENU(menu), m6);
  
  gtk_widget_show_all(menu);
  browser->doc_menu = menu;
  
  return ( menu );   
}

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* get_image_popup_menu ( MinimoBrowser browser,
gchar *  img 
)

Definition at line 108 of file minimo_context.cpp.

{
  GtkWidget *menu, *m1, *m2, *m3, *m4, *sep;
  gchar *lbl, *name, *aux_string;
  G_CONST_RETURN gchar *img_basename;
  
  if (browser->image_menu)
    gtk_widget_destroy(browser->image_menu);
  
  aux_string = (gchar *)g_malloc(1024);
  strcpy (aux_string, "");
  img_basename = g_basename(img);
  name = g_strdup(img_basename);
  menu = gtk_menu_new();
  g_object_set_data(G_OBJECT(menu), "freeimg", img);
  g_object_set_data(G_OBJECT(menu), "freename", name);
  
  /* View Image */
  m1 = gtk_image_menu_item_new_with_mnemonic ("_View image");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m1),
                                gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m1), "activate", G_CALLBACK(browse_in_window_from_popup), browser);
  g_object_set_data(G_OBJECT(m1), "link", img);
  gtk_menu_append(GTK_MENU(menu), m1);
  
  /* Separator */
  sep = gtk_menu_item_new();
  gtk_menu_append(GTK_MENU(menu), sep);
  
  /* Save as */
  m2  = gtk_image_menu_item_new_with_mnemonic ("_Save image as ...");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m2),
                                gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m2), "activate", G_CALLBACK(download_link_from_popup), browser);
  g_object_set_data(G_OBJECT(m2), "link", img);
  g_object_set_data(G_OBJECT(m2), "name", aux_string);
  gtk_menu_append(GTK_MENU(menu), m2);
  
  /* Save */
  lbl = g_strdup_printf("%s %s","Sa_ve image as ",img_basename);
  m3  = gtk_image_menu_item_new_with_mnemonic (lbl);
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m3),
                                gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m3), "activate", G_CALLBACK(save_image_from_popup), browser);
  g_object_set_data(G_OBJECT(m3), "link", img);
  g_object_set_data(G_OBJECT(m3), "name", name);
  gtk_menu_append(GTK_MENU(menu), m3);
  
  /* Separator */
  sep = gtk_menu_item_new();
  gtk_menu_append(GTK_MENU(menu), sep);
  
  /* Save page as */
  m4 = gtk_image_menu_item_new_with_mnemonic("Save page _as ... ");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m4),
                                gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU));    
  g_signal_connect(G_OBJECT(m4), "activate", G_CALLBACK(download_link_from_popup), browser);
  g_object_set_data(G_OBJECT(m4), "link", gtk_moz_embed_get_location(GTK_MOZ_EMBED (browser->mozEmbed)));
  gtk_menu_append(GTK_MENU(menu), m4);
  gtk_widget_show_all(menu);
  
  gtk_widget_show_all(menu);
  
  g_free(aux_string);       
  g_free(lbl);
  
  browser->image_menu = menu;
  return (menu);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* get_link_image_popup_menu ( MinimoBrowser browser,
gchar *  img,
gchar *  href 
)

Definition at line 227 of file minimo_context.cpp.

{
  GtkWidget *menu, *m1, *m2, *m3, *m4, *m5, *sep;
  gchar *lbl, *name, *aux_string;
  G_CONST_RETURN gchar *img_basename;
  
  if (browser->image_link_menu) 
    gtk_widget_destroy(browser->image_link_menu);
  
  aux_string= (gchar *)g_malloc(1024);
  strcpy (aux_string, "link image menu");
  
  img_basename = g_basename(img);
  menu = gtk_menu_new();
  name = g_strdup(img_basename);
  g_object_set_data(G_OBJECT(menu), "freehref", href);
  g_object_set_data(G_OBJECT(menu), "freeimg", img);
  g_object_set_data(G_OBJECT(menu), "freename", name);
  g_signal_connect(G_OBJECT(menu), "destroy", G_CALLBACK(on_menu_destroy), aux_string);
  
  /* Open Link in the current Window */
  m1 = gtk_image_menu_item_new_with_mnemonic ("_Open link ...");
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(m1),gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m1), "activate", G_CALLBACK(browse_in_window_from_popup), browser);
  g_object_set_data(G_OBJECT(m1), "link", href);
  gtk_menu_append(GTK_MENU(menu), m1);
  
  /* Open Link in a new tab */            
  m2 = gtk_image_menu_item_new_with_mnemonic ("Open link in a new _Tab");
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(m2), 
                                 gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_MENU));
  gtk_menu_append(GTK_MENU(menu), m2);
  g_object_set_data(G_OBJECT(m2), "link", href);
  g_signal_connect(G_OBJECT(m2), "activate", G_CALLBACK(make_tab_from_popup), browser);
  
  /* Separator */
  sep = gtk_menu_item_new();
  gtk_menu_append(GTK_MENU(menu), sep);
  
  /* View Image */
  m3 = gtk_image_menu_item_new_with_mnemonic ("_View image");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m3),
                                gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m3), "activate", G_CALLBACK(browse_in_window_from_popup), browser);
  g_object_set_data(G_OBJECT(m3), "link", img);       
  gtk_menu_append(GTK_MENU(menu), m3);
  
  /* Separator */
  sep = gtk_menu_item_new();
  gtk_menu_append(GTK_MENU(menu), sep);
  
  m4 = gtk_image_menu_item_new_with_mnemonic ("_Save link as ...");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m4),gtk_image_new_from_stock(GTK_STOCK_SAVE,
                                                                                 GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m4), "activate", G_CALLBACK(download_link_from_popup), browser);
  g_object_set_data(G_OBJECT(m4), "link", href);
  gtk_menu_append(GTK_MENU(menu), m4);
  
  lbl = g_strdup_printf("%s %s","Save image _as ",img_basename);
  m5  = gtk_image_menu_item_new_with_mnemonic (lbl);
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m5),gtk_image_new_from_stock(GTK_STOCK_SAVE,
                                                                                 GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m5), "activate", G_CALLBACK(save_image_from_popup), browser);
  g_object_set_data(G_OBJECT(m5), "link", img);
  g_object_set_data(G_OBJECT(m5), "name", name);
  gtk_menu_append(GTK_MENU(menu), m5);
  
  gtk_widget_show_all(menu);
  browser->image_link_menu = menu;
  
  g_free(aux_string);
  
  return ( menu );
}

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* get_link_popup_menu ( MinimoBrowser browser,
gchar *  href,
gchar *  linktext 
)

Definition at line 69 of file minimo_context.cpp.

{
  GtkWidget *menu, *m1, *m2, *m3;
  
  if (browser->link_menu) gtk_widget_destroy(browser->link_menu);
  menu = gtk_menu_new();
  g_object_set_data(G_OBJECT(menu), "freehref", href);
  g_object_set_data(G_OBJECT(menu), "freelinktext", linktext);
  
  /* Open in this Window */
  m1 = gtk_image_menu_item_new_with_mnemonic("_Open link ...");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m1),
                                gtk_image_new_from_stock(GTK_STOCK_OPEN,GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m1), "activate", G_CALLBACK(browse_in_window_from_popup), browser);
  g_object_set_data(G_OBJECT(m1), "link", href);
  gtk_menu_append(GTK_MENU(menu), m1);
  
  /* Open in a new Tab */
  m2 = gtk_image_menu_item_new_with_mnemonic("Open in a new _tab");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m2),
                                gtk_image_new_from_stock(GTK_STOCK_NEW,GTK_ICON_SIZE_MENU));
  gtk_menu_append(GTK_MENU(menu), m2);
  g_object_set_data(G_OBJECT(m2), "link", href);
  g_signal_connect(G_OBJECT(m2), "activate", G_CALLBACK(make_tab_from_popup), browser);           
  
  /* Download link */
  m3  = gtk_image_menu_item_new_with_mnemonic("_Save link as ...");
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(m3),
                                gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU));
  g_signal_connect(G_OBJECT(m3), "activate", G_CALLBACK(download_link_from_popup), browser);
  g_object_set_data(G_OBJECT(m3), "link", href);
  gtk_menu_append(GTK_MENU(menu), m3);
  
  gtk_widget_show_all(menu);
  browser->link_menu = menu;
  return (menu);
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void on_menu_destroy ( GtkWidget *  menu,
gchar *  name 
)

Definition at line 54 of file minimo_context.cpp.

{
  gchar *free_href, *free_img, *free_linktext, *free_name;
  
  free_href = (gchar *) g_object_get_data(G_OBJECT(menu), "freehref");
  if (free_href) g_free(free_href);
  free_img = (gchar *) g_object_get_data(G_OBJECT(menu), "freeimg");
  if (free_img) g_free(free_img);
  free_linktext = (gchar *) g_object_get_data(G_OBJECT(menu), "freelinktext");
  if (free_linktext) g_free(free_linktext);
  free_name = (gchar *) g_object_get_data(G_OBJECT(menu), "freename");
  if (free_name) g_free(free_name);
  return;
}

Here is the caller graph for this function: