/* Called from rebuild. All panels must be cleaned out of things | that will be recreated in the create() routines. GKrellM <= 1.0.x | left it up to plugins to destroy decal/krell lists. Now this is | enforced, but grandfather out the plugins have not upgraded to using | the new gkrellm_panel_create() functions. */ void gkrellm_panel_cleanup(void) { GList *list, *list1; GkrellmPanel *p; for (list = panel_list; list; list = list->next) { p = (GkrellmPanel *) list->data; if (!p->keep_lists) { gkrellm_destroy_krell_list(p); gkrellm_destroy_decal_list(p); /* Also destroys buttons */ if (p->krell_list || p->decal_list || p->button_list) fprintf(stderr, "GKrellM: gkrellm_panel_cleanup krell=%p decal=%p button=%p\n", p->krell_list, p->decal_list, p->button_list); } else { for (list1 = p->decal_list; list1; list1 = list1->next) ((GkrellmDecal *) list1->data)->value = -1; for (list1 = p->krell_list; list1; list1 = list1->next) ((GkrellmKrell *) list1->data)->x_position = -1; } p->h = 0; p->h_configure = 0; p->style = NULL; } }
static void create_panel(GtkWidget *vbox, Reader *reader, gint first_create) { // GkrellmKrell *k; GkrellmStyle *style; // GkrellmPiximage *krell_piximage; gchar *text; if (first_create) reader->panel = gkrellm_panel_new0(); else gkrellm_destroy_krell_list(reader->panel); /* Create a krell. A Krell structure is allocated and linked into | the list of krells pointed to by panel->krell. */ style = gkrellm_meter_style(DEFAULT_STYLE_ID); //GTK2 style->label_position = LABEL_CENTER; // krell_piximage = gkrellm_krell_meter_piximage(DEFAULT_STYLE_ID); // k = gkrellm_create_krell(panel, krell_piximage, style); // k->full_scale = 30; /* Configure panel calculates the panel height needed for the "Plugin" label. | and the krell. */ reader->panel->textstyle = gkrellm_meter_textstyle(DEFAULT_STYLE_ID); gkrellm_panel_configure(reader->panel, "SNMP", style); // reader->panel->textstyle = gkrellm_panel_alt_textstyle(DEFAULT_STYLE_ID); /* Build the configured panel with a background image and pack it into | the vbox assigned to this monitor. */ //dep: gkrellm_create_panel(vbox, reader->panel, gkrellm_bg_meter_piximage(DEFAULT_STYLE_ID)); gkrellm_panel_create(vbox, mon, reader->panel); gkrellm_monitor_height_adjust(reader->panel->h); if (first_create) { gtk_signal_connect(GTK_OBJECT (reader->panel->drawing_area), "expose_event", (GtkSignalFunc) panel_expose_event, NULL); reader->tooltip=gtk_tooltips_new(); } /* refresh the display */ text = render_label(reader); gkrellm_dup_string(&reader->panel->label->string, text); g_free(text); }
void gkrellm_panel_destroy(GkrellmPanel *p) { if (!p) return; gkrellm_reset_panel_alerts(p); gkrellm_destroy_krell_list(p); gkrellm_destroy_decal_list(p); /* Also destroys buttons */ if (p->button_list || p->button_signals_connected) fprintf(stderr, "gkrellm_destroy_panel: button_list=%p connected=%d\n", p->button_list, p->button_signals_connected); if (p->label) { if (p->label->string) g_free(p->label->string); g_free(p->label); } if (p->layout) g_object_unref(G_OBJECT(p->layout)); if (p->textstyle && p->textstyle->internal) g_free(p->textstyle); if (p->pixmap) g_object_unref(G_OBJECT(p->pixmap)); if (p->bg_pixmap) g_object_unref(G_OBJECT(p->bg_pixmap)); if (p->bg_text_layer_pixmap) g_object_unref(G_OBJECT(p->bg_text_layer_pixmap)); if (p->bg_clean_pixmap) g_object_unref(G_OBJECT(p->bg_clean_pixmap)); if (p->bg_mask) g_object_unref(G_OBJECT(p->bg_mask)); if (p->hbox) gtk_widget_destroy(p->hbox); panel_list = g_list_remove(panel_list, p); if (p->shown) gkrellm_monitor_height_adjust(- p->h); g_free(p); gkrellm_pack_side_frames(); }