void   
awn_applet_simple_set_icon_info (AwnAppletSimple  *applet,
                                 GStrv            states,
                                 GStrv            icon_names)
{
  gchar *applet_name=NULL;
  
  g_return_if_fail (AWN_IS_APPLET_SIMPLE (applet));
  g_return_if_fail (states);
  g_return_if_fail (icon_names);

  g_object_get (applet,
                "canonical-name",&applet_name,
                NULL);  
  g_return_if_fail (applet_name);
  applet->priv->last_set_icon = ICON_THEMED_MANY;
  awn_themed_icon_set_size (AWN_THEMED_ICON (applet->priv->icon),
                            awn_applet_get_size (AWN_APPLET (applet)));
  awn_themed_icon_set_info (AWN_THEMED_ICON (applet->priv->icon),
                            applet_name,
                            awn_applet_get_uid (AWN_APPLET (applet)),
                            states,
                            icon_names);
  g_free (applet_name);
}
예제 #2
0
static void
cairo_main_icon_constructed (GObject *object)
{
  CairoMainIconPrivate * priv = GET_PRIVATE (object);
  GdkPixbuf * pbuf;
  gint size = awn_applet_get_size (priv->applet);
  G_OBJECT_CLASS (cairo_main_icon_parent_class)->constructed (object);

  awn_themed_icon_set_info_simple (AWN_THEMED_ICON(object),"cairo-menu",awn_applet_get_uid (priv->applet),"gnome-main-menu");
  awn_themed_icon_set_size (AWN_THEMED_ICON (object),size);

  gtk_drag_dest_set (GTK_WIDGET (object),
                       GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
                       drop_types, n_drop_types,
                       GDK_ACTION_COPY | GDK_ACTION_ASK);
  /* call our function in the module */

  priv->menu_instance = get_menu_instance (priv->applet,
                                          (GetRunCmdFunc)cairo_menu_applet_get_run_cmd,
                                          (GetSearchCmdFunc)cairo_menu_applet_get_search_cmd,
                                          (AddIconFunc) cairo_menu_applet_add_icon,
                                          (CheckMenuHiddenFunc) cairo_menu_applet_check_hidden_menu,
                                          NULL,
                                          0);

  g_idle_add ( (GSourceFunc)queue_menu_build, object);
  awn_icon_set_tooltip_text (AWN_ICON (object), _("Main Menu"));
}
예제 #3
0
static void
size_changed_cb (CairoMainIcon * icon,gint size)
{
  CairoMainIconPrivate * priv = GET_PRIVATE (icon);

  awn_themed_icon_set_size (AWN_THEMED_ICON (icon),awn_applet_get_size (priv->applet));
}
예제 #4
0
AwnApplet* awn_applet_factory_initp(const gchar *name,
                                    const gchar* uid, gint panel_id)
{
    AwnApplet *applet = AWN_APPLET(awn_applet_simple_new(name, uid, panel_id));
    CpuMeter *cpumeter;

    g_object_set (applet,
                  "display-name","Awn System Monitor",
                  NULL);
    gint height = awn_applet_get_size(applet);

    gtk_widget_set_size_request(GTK_WIDGET(applet), height*1.25, -1);


    GdkPixbuf *icon;
#if 0
    icon = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
                                    "gnome-main-menu",
                                    height - 2,
                                    0, NULL);
    awn_applet_simple_set_temp_icon(AWN_APPLET_SIMPLE(applet), icon);
#endif
    /*setting to a transparent pixbuf to begin with... awn-effects (I think)
    does not seem to deal well with having the icon set overly late*/

#if 1
    icon = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, height, height);
    gdk_pixbuf_fill(icon, 0x00000000);
    awn_applet_simple_set_icon_pixbuf(AWN_APPLET_SIMPLE(applet), icon);
#endif
    cpumeter = cpumeter_applet_new(applet);
    cpumeter->height = height;
    /*gtk_widget_show_all(GTK_WIDGET(applet));*/
    return applet;
}
예제 #5
0
파일: cpuicon.c 프로젝트: micove/awn-extras
static void
_graph_type_change(GObject *object, GParamSpec *pspec, AwnApplet *applet)
{
  AwnGraphType graph_type;  
  static int old_graph = -1;
  AwnGraph  *graph = NULL;
  gint size = awn_applet_get_size (applet);
  
  graph_type = get_conf_value_int(G_OBJECT(object),"graph-type");
  
  if (old_graph != graph_type)
  {      
    switch (graph_type)
    {
      default:
        g_warning ("Invalid graph type");
      case GRAPH_DEFAULT:
      case GRAPH_AREA:
        graph = AWN_GRAPH(awn_areagraph_new (size,0.0,100.0));
        break;
      case GRAPH_CIRCLE:
        graph = AWN_GRAPH(awn_circlegraph_new (0.0,100.0));
        break;
      case GRAPH_BAR:
        graph = AWN_GRAPH(awn_bargraph_new (0.0,100.0));
        break;      
    }
    g_object_set (G_OBJECT (object),
                  "graph",graph,
                  NULL);
    old_graph = graph_type;
  }  
}
예제 #6
0
static void
awn_loadicon_constructed (GObject *object)
{
  AwnLoadiconPrivate * priv;
  AwnSysmoniconPrivate * sysmonicon_priv=NULL;
  gint size;
  AwnGraphType graph_type;

  g_assert (G_OBJECT_CLASS ( awn_loadicon_parent_class) );
  G_OBJECT_CLASS ( awn_loadicon_parent_class)->constructed(object);

  priv = AWN_LOADICON_GET_PRIVATE (object);
  sysmonicon_priv = AWN_SYSMONICON_GET_PRIVATE (object);

  if ( (priv->update_timeout > 750) &&
      ( (priv->update_timeout %1000 <25) || (priv->update_timeout %1000 >975)))
  {
    priv->timer_id = g_timeout_add_seconds(priv->update_timeout/ 1000,
                                           _awn_loadicon_update_icon,
                                           object);
  }
  else
  {
    priv->timer_id = g_timeout_add(priv->update_timeout, _awn_loadicon_update_icon, object);
  }
  size = awn_applet_get_size (sysmonicon_priv->applet);

  /*CONDITIONAL*/
  graph_type = sysmonicon_priv->graph_type[CONF_STATE_INSTANCE];
  /*FIXME add in default fallback */

  switch (graph_type)
  {
    case GRAPH_DEFAULT:
    case GRAPH_BAR:
      sysmonicon_priv->graph = AWN_GRAPH(awn_bargraph_new (0.0,5.0));
      break;
    case GRAPH_CIRCLE:
    case GRAPH_AREA:
    default:
      g_assert_not_reached();
  }

}
예제 #7
0
파일: applet.c 프로젝트: micove/awn-extras
static void
site_clicked(GtkButton *button, WebSite *site)
{
  go_to_url(site->webapplet, site->url);

  gint size = awn_applet_get_size(site->webapplet->applet);

  gchar *path = g_strdup_printf(APPLETSDIR"/webapplet/icons/%s", site->icon);
  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(path, size, size, NULL);
  awn_applet_simple_set_icon_pixbuf(AWN_APPLET_SIMPLE(site->webapplet->applet), pixbuf);

  if (site->width && site->height)
  {
    gtk_widget_set_size_request(GTK_WIDGET(site->webapplet->box),
                                site->width, site->height);
  }

  /* Set as new home page if this is either in the main menu, or 
   * in the dialog with 'set as new home page' checked */
  if (!GTK_IS_WIDGET(site->webapplet->check_home) ||
      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(site->webapplet->check_home)))
  {
    config_set_uri(site->webapplet, site->url);
    config_set_site(site->webapplet, site->name);

    if (GTK_IS_WIDGET(site->webapplet->location_dialog))
      gtk_widget_destroy(site->webapplet->location_dialog);
  }

  if (GTK_IS_WIDGET(site->webapplet->location_dialog))
    gtk_widget_destroy(site->webapplet->location_dialog);

  else
    config_set_first_start(site->webapplet, FALSE);

  /* Set the title to the name of the website */
  awn_applet_simple_set_tooltip_text(AWN_APPLET_SIMPLE(site->webapplet->applet),
                                     site->name);

  g_free(path);
}
void
awn_applet_simple_set_icon_name (AwnAppletSimple  *applet,
                                 const gchar      *icon_name)
{
  gchar *applet_name;  
  
  g_return_if_fail (AWN_IS_APPLET_SIMPLE (applet));
  g_return_if_fail (icon_name);

  g_object_get (applet,
                "canonical-name",&applet_name,
                NULL);

  g_return_if_fail (applet_name);

  applet->priv->last_set_icon = ICON_THEMED_SIMPLE;
  awn_themed_icon_set_size (AWN_THEMED_ICON (applet->priv->icon),
                            awn_applet_get_size (AWN_APPLET (applet)));  
  awn_themed_icon_set_info_simple (AWN_THEMED_ICON (applet->priv->icon),
                                   applet_name,
                                   awn_applet_get_uid (AWN_APPLET (applet)),
                                   icon_name);
  g_free (applet_name);
}
예제 #9
0
파일: applet.c 프로젝트: micove/awn-extras
AwnApplet *
awn_applet_factory_initp (const gchar *name, gchar* uid, gint panel_id)
{
  g_on_error_stack_trace (NULL);
  html_init ();
  WebApplet *webapplet = g_malloc (sizeof (WebApplet));
  webapplet->uid=g_strdup(uid);
  webapplet->check_home = NULL;
  webapplet->location_dialog = NULL;
  webapplet->start = NULL;
  webapplet->applet = AWN_APPLET (awn_applet_simple_new (name, uid, panel_id));
  init_config (webapplet);
  gint height = awn_applet_get_size(webapplet->applet);

  awn_applet_simple_set_icon_name(AWN_APPLET_SIMPLE(webapplet->applet),
                                  ICON_NAME);
 
  /*gtk_widget_show_all (GTK_WIDGET (webapplet->applet));*/
  awn_html_dialog_new (webapplet);
  gtk_window_set_focus_on_map (GTK_WINDOW (webapplet->mainwindow), TRUE);
  g_signal_connect_after (G_OBJECT (webapplet->applet), "realize",
                          G_CALLBACK (_bloody_thing_has_style), webapplet);
  return webapplet->applet;
}
예제 #10
0
파일: applet.c 프로젝트: micove/awn-extras
static void
awn_html_dialog_new(WebApplet *webapplet)
{
  /* create viewer */
  webapplet->mainwindow = awn_dialog_new_for_widget (GTK_WIDGET(webapplet->applet));
  webapplet->box = gtk_vbox_new (FALSE, 1);

  webapplet->viewer = html_web_view_new ();

  /* Load the .ini file for websites */
  GError *err = NULL;
  webapplet->sites_file = g_key_file_new();

  g_key_file_load_from_file(webapplet->sites_file,
                            APPLETSDIR"/webapplet/webapplet-websites.ini",
                            0, &err);

  if (err)
  {
    printf("Error loading websites: %s\n", err->message);
    g_error_free(err);
    g_key_file_free(webapplet->sites_file);
    webapplet->sites_file = NULL;
  }

  /* If first time using this, hide WebView, show location entry/website buttons */
  if (config_get_first_start(webapplet))
  {
    gtk_widget_set_no_show_all(webapplet->viewer, TRUE);

    gtk_box_pack_start(GTK_BOX(webapplet->box), first_start(webapplet),
                       FALSE, FALSE, 0);

    awn_applet_simple_set_tooltip_text(AWN_APPLET_SIMPLE(webapplet->applet),
                                       _("Web Applet"));
  }

  else
  {
    go_to_url(webapplet, (gchar*)config_get_uri(webapplet));

    if (webapplet->sites_file)
    {
      const gchar *name = config_get_site(webapplet);

      if (name && strcmp(name, "") != 0)
      {
        gint size = awn_applet_get_size(webapplet->applet);

        WebSite *site = get_site(webapplet, (gchar*)name);
        gchar *path = g_strdup_printf(APPLETSDIR"/webapplet/icons/%s", site->icon);
        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(path, size, size, NULL);
        awn_applet_simple_set_icon_pixbuf(AWN_APPLET_SIMPLE(site->webapplet->applet), pixbuf);

        if (site->width && site->height)
        {
          gtk_widget_set_size_request(GTK_WIDGET(site->webapplet->box),
                                      site->width, site->height);
        }
      }
    }
  }

  gtk_box_pack_start(GTK_BOX(webapplet->box), webapplet->viewer, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(webapplet->mainwindow), webapplet->box);
}