示例#1
0
static void datasource_osm_my_traces_add_setup_widgets ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data )
{
    datasource_osm_my_traces_t *data = (datasource_osm_my_traces_t *)user_data;

    GtkWidget *user_label;
    GtkWidget *password_label;
    user_label = gtk_label_new(_("Username:"******"The email or username used to login to OSM") );

    password_label = gtk_label_new ( _("Password:"******"The password used to login to OSM") );

    osm_login_widgets (data->user_entry, data->password_entry);
    gtk_widget_show_all ( dialog );

    /* Keep reference to viewport */
    data->vvp = vvp;
}
示例#2
0
void p_link_contains()
{
	
         GtkWidget *window;
	GtkBuilder *builder;
	GtkWidget *button11,
                            *button22,
                            *button33;
    
	GtkWidget *label11;
	GtkWidget *label22;
	GtkWidget *label33;
	GtkWidget *label44;
	GtkWidget *p_combox;
    
	builder=gtk_builder_new ();
    
	gtk_builder_add_from_file (builder,P_LINK,NULL);
	window=GTK_WIDGET(gtk_builder_get_object (builder, P_LINK_WINDOW));
	label11=GTK_WIDGET(gtk_builder_get_object (builder,"label1"));
	label22=GTK_WIDGET(gtk_builder_get_object (builder,"label2"));
	label33=GTK_WIDGET(gtk_builder_get_object (builder,"label3"));
	label44=GTK_WIDGET(gtk_builder_get_object (builder,"label4"));
	p_combox=GTK_WIDGET(gtk_builder_get_object (builder,"combobox1"));
	p_entry=GTK_WIDGET(gtk_builder_get_object (builder,"entry2"));
	p_entry_con=GTK_WIDGET(gtk_builder_get_object (builder,"entry1"));
	//create_contians_view_entry22=GTK_WIDGET(gtk_builder_get_object (builder,"entry2"));
	button11=GTK_WIDGET(gtk_builder_get_object (builder,"button1"));
	button22=GTK_WIDGET(gtk_builder_get_object (builder,"button2"));
	button33=GTK_WIDGET(gtk_builder_get_object (builder,"button3"));
	gtk_window_set_title (GTK_WINDOW(window),_("External access"));
	gtk_label_set_text (GTK_LABEL(label11),_("please input image"));
	//gtk_label_set_selectable(label11,TRUE);
	gtk_label_set_text (GTK_LABEL(label33),_("please input yourself contains name"));
	gtk_label_set_text (GTK_LABEL(label22),_("Please enter the mapping port number"));
	gtk_label_set_text (GTK_LABEL(label44),_("image                             tag"));
	gtk_button_set_label (GTK_BUTTON(button22),_("Writing format:"));
	gtk_button_set_label (GTK_BUTTON(button33),_("Port changes or additions:"));
	
	gtk_button_set_label (GTK_BUTTON(button11),_("sure"));
	add_data_combox(p_combox);
	gtk_widget_set_tooltip_markup (button22,_("<span foreground=\"#000000\">-P(Random mapping port).-p 500:22 (put host 50 port to contain 22).</span>"));
	gtk_widget_set_tooltip_markup (button33,_("<span foreground=\"#000000\">Example:put A contain export,then import A produce a image</span>"));
	//gtk_widget_set_tooltip_text(button11,"sadasdasd");
	
        g_signal_connect(G_OBJECT(p_combox),"changed",G_CALLBACK(p_combx_changed),NULL);
        g_signal_connect(G_OBJECT(button11),"clicked",G_CALLBACK(p_button11_clicked),NULL);
        //g_signal_connect(G_OBJECT(button22),"enter",G_CALLBACK(p_button22_clicked),label11);
        //g_signal_connect(G_OBJECT(button22),"leave",G_CALLBACK(p_button22_clicked_leave),label11);
        g_object_unref (builder);
        gtk_widget_show_all (window);
        
        //gtk_widget_hide (label11);
        //g_printf("ppppp\n");

}
示例#3
0
文件: net.c 项目: g7/fbpanel
static int
net_get_load(net_priv *c)
{
    struct net_stat net, net_diff;
    float total[2];
    char buf[256];

    ENTER;
    memset(&net, 0, sizeof(net));
    memset(&net_diff, 0, sizeof(net_diff));
    memset(&total, 0, sizeof(total));

    if (net_get_load_real(c, &net))
        goto end;

    net_diff.tx = ((net.tx - c->net_prev.tx) >> 10) / CHECK_PERIOD;
    net_diff.rx = ((net.rx - c->net_prev.rx) >> 10) / CHECK_PERIOD;

    c->net_prev = net;
    total[0] = (float)(net_diff.tx) / c->max;
    total[1] = (float)(net_diff.rx) / c->max;

end:
    DBG("%f %f %ul %ul\n", total[0], total[1], net_diff.tx, net_diff.rx);
    k->add_tick(&c->chart, total);
    g_snprintf(buf, sizeof(buf), "<b>%s:</b>\nD %lu Kbs, U %lu Kbs",
        c->iface, net_diff.rx, net_diff.tx);
    gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid, buf);
    RET(TRUE);
}
示例#4
0
文件: finfo.c 项目: iuli09/RAle
static void 
incarca_info_general(GtkWidget *cadruFrm) {
  GtkWidget *cadruTitluEtichete = NULL;
  GtkWidget *cadruValEtichete = NULL;
  gchar versActualaLocala[10];
  
  g_sprintf(versActualaLocala, PSALE_FORMAT_VERSIUNE, db_obtine_versiune_curenta());
  
  /* inițializăm cadrul etichetelor (titlu + valoare) */
  cadruTitluEtichete = gtk_vbox_new(FALSE, 4);
  gtk_table_attach_defaults(GTK_TABLE(cadruFrm), cadruTitluEtichete, 1, 2, 0, 1);

  GtkWidget *lblTitluAutor = gtk_label_new("Autor : ");
  GtkWidget *lblTitluVersiune = gtk_label_new("Versiune : ");
  GtkWidget *lblTitluLicenta = gtk_label_new("Licență : ");

  gtk_misc_set_alignment(GTK_MISC(lblTitluAutor), 1.0f, 0.1f);
  gtk_misc_set_alignment(GTK_MISC(lblTitluVersiune), 1.0f, 0.1f);
  gtk_misc_set_alignment(GTK_MISC(lblTitluLicenta), 1.0f, 0.1f);

  gtk_container_add(GTK_CONTAINER(cadruTitluEtichete), lblTitluAutor);
  gtk_container_add(GTK_CONTAINER(cadruTitluEtichete), lblTitluVersiune);
  gtk_container_add(GTK_CONTAINER(cadruTitluEtichete), lblTitluLicenta);
  
  cadruValEtichete = gtk_vbox_new(FALSE, 4);
  gtk_table_attach_defaults(GTK_TABLE(cadruFrm), cadruValEtichete, 2, 3, 0, 1);

  GtkWidget *lblValAutor = gtk_label_new(PSALE_NUME_AUTOR);
  GtkWidget *lblValVersiune = gtk_label_new(versActualaLocala);
  GdkPixbuf *pixImgLicenta = fl_obtine_imagine_media_scalata(FL_IMG_FINFO_LICENTA, -1, -1);
  GtkWidget *imgLicenta = gtk_image_new_from_pixbuf(pixImgLicenta);
  g_object_unref(pixImgLicenta);
  GtkWidget *cadruImgLicenta = gtk_event_box_new();

  gtk_misc_set_alignment(GTK_MISC(lblValAutor), 1.0f, 0.1f);
  gtk_misc_set_alignment(GTK_MISC(lblValVersiune), 1.0f, 0.1f);
  gtk_misc_set_alignment(GTK_MISC(imgLicenta), 1.0f, 0.1f);
  gtk_widget_set_tooltip_markup(cadruImgLicenta, "Prezintă informații sumare despre licența aplicației.\n<i>(click pentru a o deschide online)</i>");
  g_signal_connect(cadruImgLicenta, "button-press-event", G_CALLBACK(imgLicenta_click), NULL);
  gtk_container_add(GTK_CONTAINER(cadruImgLicenta), imgLicenta);

  gtk_container_add(GTK_CONTAINER(cadruValEtichete), lblValAutor);
  gtk_container_add(GTK_CONTAINER(cadruValEtichete), lblValVersiune);
  gtk_container_add(GTK_CONTAINER(cadruValEtichete), cadruImgLicenta);

  /* inițializăm regiunea de informații generale (și scurtături ?) */
  GtkWidget *lblDespre = gtk_label_new("Despre : ");

  gtk_misc_set_alignment(GTK_MISC(lblDespre), 1.0f, 0.02f);
  gtk_table_attach_defaults(GTK_TABLE(cadruFrm), lblDespre, 1, 2, 1, 2);

  GtkWidget *txtView = gtk_text_view_new();
  GtkTextBuffer *txtBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(txtView));

  gtk_text_buffer_set_text(txtBuffer, PSALE_TEXT_DESPRE, -1);
  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(txtView), FALSE);
  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(txtView), GTK_WRAP_WORD);
  gtk_text_view_set_editable(GTK_TEXT_VIEW(txtView), FALSE);
  gtk_table_attach_defaults(GTK_TABLE(cadruFrm), txtView, 2, 4, 1, 2);
}
示例#5
0
文件: net.c 项目: g7/fbpanel
static int
net_constructor(plugin_instance *p)
{
    net_priv *c;

    if (!(k = class_get("chart")))
        RET(0);
    if (!PLUGIN_CLASS(k)->constructor(p))
        RET(0);
    c = (net_priv *) p;

    c->iface = "eth0";
    c->max_rx = 120;
    c->max_tx = 12;
    c->colors[0] = "violet";
    c->colors[1] = "blue";
    XCG(p->xc, "interface", &c->iface, str);
    XCG(p->xc, "RxLimit", &c->max_rx, int);
    XCG(p->xc, "TxLimit", &c->max_tx, int);
    XCG(p->xc, "TxColor", &c->colors[0], str);
    XCG(p->xc, "RxColor", &c->colors[1], str);

    init_net_stats(c);

    c->max = c->max_rx + c->max_tx;
    k->set_rows(&c->chart, 2, c->colors);
    gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid, "<b>Net</b>");
    net_get_load(c);
    c->timer = g_timeout_add(CHECK_PERIOD * 1000,
        (GSourceFunc) net_get_load, (gpointer) c);
    RET(1);
}
示例#6
0
static gboolean
volume_update_gui(volume_priv *c)
{
    int volume;
    gchar buf[20];

    ENTER;
    volume = oss_get_volume(c);
    if ((volume != 0) != (c->vol != 0)) {
        if (volume)
            k->set_icons(&c->meter, names);
        else
            k->set_icons(&c->meter, s_names);
        DBG("seting %s icons\n", volume ? "normal" : "muted");
    }
    c->vol = volume;
    k->set_level(&c->meter, volume);
    g_snprintf(buf, sizeof(buf), "<b>Volume:</b> %d%%", volume);
    if (!c->slider_window)
        gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid, buf);
    else {
        g_signal_handlers_block_by_func(G_OBJECT(c->slider),
            G_CALLBACK(slider_changed), c);
        gtk_range_set_value(GTK_RANGE(c->slider), volume);
        g_signal_handlers_unblock_by_func(G_OBJECT(c->slider),
            G_CALLBACK(slider_changed), c);
    }
    RET(TRUE);
}
示例#7
0
static gboolean
icon_clicked(GtkWidget *widget, GdkEventButton *event, volume_priv *c)
{
    int volume;

    ENTER;
    if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
        if (c->slider_window == NULL) {
            c->slider_window = volume_create_slider(c);
            gtk_widget_show_all(c->slider_window);
            gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid, NULL);
        } else {
            gtk_widget_destroy(c->slider_window);
            c->slider_window = NULL;
            if (c->leave_id) {
                g_source_remove(c->leave_id);
                c->leave_id = 0;
            }
        }
        RET(FALSE);
    }
    if (!(event->type == GDK_BUTTON_PRESS && event->button == 2))
        RET(FALSE);
    
    if (c->muted) {
        volume = c->muted_vol;
    } else {
        c->muted_vol = c->vol;
        volume = 0;
    }
    c->muted = !c->muted;
    oss_set_volume(c, volume);
    volume_update_gui(c);
    RET(FALSE);
}
示例#8
0
文件: dnd.c 项目: eydunn/yad-dialog
void
dnd_init (GtkWidget * w)
{
  GtkTargetList *tlist;
  GtkTargetEntry *tgts;
  gint ntgts;

  tlist = gtk_target_list_new (NULL, 0);
  gtk_target_list_add_uri_targets (tlist, 0);
  gtk_target_list_add_text_targets (tlist, 0);

  tgts = gtk_target_table_new_from_list (tlist, &ntgts);

  gtk_drag_dest_set (w, GTK_DEST_DEFAULT_ALL, tgts, ntgts, GDK_ACTION_COPY | GDK_ACTION_MOVE);
  g_signal_connect (G_OBJECT (w), "drag_data_received", G_CALLBACK (drop_data_cb), NULL);

  gtk_target_table_free (tgts, ntgts);
  gtk_target_list_unref (tlist);

  /* set tooltip */
  if (options.dnd_data.tooltip)
    {
      GtkWidget *box;

      box = gtk_dialog_get_content_area (GTK_DIALOG (w));
      if (!options.data.no_markup)
        gtk_widget_set_tooltip_markup (box, options.data.dialog_text);
      else
        gtk_widget_set_tooltip_text (box, options.data.dialog_text);
    }
}
示例#9
0
void systray_set_tooltip(GtkWidget* item, const char* tooltip)
{
    char* escaped = g_markup_escape_text(tooltip, -1);
    char* markup = g_strdup_printf("<span font_family=\"monospace\" font_size=\"x-small\">%s</span>", escaped);
    gtk_widget_set_tooltip_markup(item, markup);
    g_free(escaped);
    g_free(markup);
}
示例#10
0
static void pama_source_output_widget_update_values(PamaSourceOutputWidget *widget)
{
	PamaSourceOutputWidgetPrivate *priv = PAMA_SOURCE_OUTPUT_WIDGET_GET_PRIVATE(widget);
	gchar           *temp;
	gchar           *stream_name, *client_name;
	gchar           *hostname, *application_id;
	gboolean         is_local;
	gboolean         is_pulseaudio;
	PamaPulseClient *client;
	PamaPulseSource *source;
	GIcon           *icon;

	priv->updating = TRUE;

	g_object_get(priv->source_output,
	             "client", &client,
	             "name",   &stream_name,
	             "source", &source,
	             NULL);

	g_object_get(client,
	             "name",     &client_name, 
	             "hostname", &hostname,
	             "is-local", &is_local,
	             "application-id", &application_id,
	             NULL);

	icon = pama_pulse_source_output_build_gicon(priv->source_output);
	g_object_set(priv->icon,
	             "gicon", icon,
	             "pixel-size", 32,
	             NULL);
	g_object_unref(icon);

	if (is_local)
		temp = g_markup_printf_escaped("<b>%s</b>\n%s", client_name, stream_name);
	else
		temp = g_markup_printf_escaped("<b>%s</b> (on %s)\n%s", client_name, hostname, stream_name);
	gtk_label_set_markup(GTK_LABEL(priv->name), temp);
	gtk_widget_set_tooltip_markup(GTK_WIDGET(priv->name), temp);
	g_free(temp);
	g_free(stream_name);
	g_free(client_name);

	// Ideally, this would be done by checking the source output's flags for
	// PA_STREAM_DONT_MOVE, but we don't have that information
	is_pulseaudio = 0 == strcmp(application_id, "org.PulseAudio.PulseAudio");
	gtk_widget_set_sensitive(priv->source_button, !is_pulseaudio);

	g_object_set(priv->source_button_image,
	             "gicon", pama_pulse_source_build_gicon(source),
	             NULL);

	g_object_unref(client);
	g_object_unref(source);

	priv->updating = FALSE;
}
示例#11
0
文件: fish.c 项目: lanoxx/gnome-panel
static void
set_tooltip (FishApplet *fish)
{
	const char *desc_format = _("%s the Fish, the fortune teller");
	char       *desc;

	desc = g_markup_printf_escaped (desc_format, fish->name);
	gtk_widget_set_tooltip_markup (GTK_WIDGET (fish), desc);
	g_free (desc);
}
示例#12
0
文件: gui_util.c 项目: bert/fped
GtkWidget *label_in_box_new(const char *s, const char *tooltip)
{
	GtkWidget *evbox, *label;

	evbox = gtk_event_box_new();
	label = gtk_label_new(s);
	gtk_misc_set_padding(GTK_MISC(label), 1, 1);
	gtk_container_add(GTK_CONTAINER(evbox), label);
	if (tooltip)
		gtk_widget_set_tooltip_markup(evbox, tooltip);
	return label;
}
示例#13
0
static void  lunar_calendar_day_selected(GtkCalendar *gcalendar)
{
	guint year, month, day;
	GError *error = NULL;
	LunarCalendar *calendar;
	gchar *holiday, *format, *strtime, *color;

	calendar = LUNAR_CALENDAR(gcalendar);

	if (getenv("LUNAR_CALENDAR_IGNORE_NON_CHINESE") != NULL)
	{
		const gchar* const * langs =  g_get_language_names();

		if (langs[0] && langs[0][0] != '\0')
			if (!g_str_has_prefix(langs[0], "zh_")) {
				g_object_set (gcalendar, "show-details", FALSE, NULL);
				return;
			}
	}

	gtk_calendar_get_date(gcalendar, &year, &month, &day);
	lunar_date_set_solar_date(calendar->date, year, month + 1, day, 3, &error);
	if (error != NULL) {
		g_clear_error (&error);
		return;
	}

	color = rgba_to_string(calendar->rgba);
	holiday = lunar_date_get_holiday(calendar->date, "\n");
	if (holiday != NULL) {
		format = g_strdup_printf("%s\n%s\n%s\n%s\n<span color=\"%s\">%s</span>",
				_("%(year)-%(month)-%(day)"),
				_("%(YUE)yue%(RI)"),
				_("%(Y60)nian%(M60)yue%(D60)ri"),
				_("shengxiao: %(shengxiao)"),
				color,
				holiday);
	} else {
		format = g_strdup_printf("%s\n%s\n%s\n%s",
				_("%(year)-%(month)-%(day)"),
				_("%(YUE)yue%(RI)"),
				_("%(Y60)nian%(M60)yue%(D60)ri"),
				_("shengxiao: %(shengxiao)"));
	}
	strtime = lunar_date_strftime(calendar->date, format);
	g_free(color);
	g_free(holiday);
	g_free(format);

	gtk_widget_set_tooltip_markup(GTK_WIDGET(gcalendar), strtime);
	g_free(strtime);
}
示例#14
0
文件: battery.c 项目: g7/fbpanel
static gboolean
battery_update(battery_priv *c)
{
    gchar buf[50];
    gchar **i;

    ENTER;
    battery_update_os(c);
    if (c->exist) {
        i = c->charging ? batt_charging : batt_working;
        g_snprintf(buf, sizeof(buf), "<b>Battery:</b> %d%%%s",
            (int) c->level, c->charging ? "\nCharging" : "");
        gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid, buf);
    } else {
        i = batt_na;
        gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid,
            "Runing on AC\nNo battery found");
    }
    k->set_icons(&c->meter, i);
    k->set_level(&c->meter, c->level);
    RET(TRUE);
}
示例#15
0
文件: gui_util.c 项目: bert/fped
GtkWidget *make_image(GdkDrawable *drawable, char **xpm, const char *tooltip)
{
	GdkPixmap *pixmap;
	GtkWidget *image;
	GdkColor white = get_color("white");

	pixmap = gdk_pixmap_create_from_xpm_d(drawable, NULL, &white, xpm);
	image = gtk_image_new_from_pixmap(pixmap, NULL);
	gtk_misc_set_padding(GTK_MISC(image), 1, 1);
	if (tooltip)
		gtk_widget_set_tooltip_markup(image, tooltip);
	return image;
}
示例#16
0
文件: gtktoolitem.c 项目: jjardon/gtk
/**
 * gtk_tool_item_set_tooltip_markup:
 * @tool_item: a #GtkToolItem
 * @markup: markup text to be used as tooltip for @tool_item
 *
 * Sets the markup text to be displayed as tooltip on the item.
 * See gtk_widget_set_tooltip_markup().
 *
 * Since: 2.12
 **/
void
gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
                                  const gchar *markup)
{
    GtkWidget *child;

    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    child = GTK_BIN (tool_item)->child;

    if (child)
        gtk_widget_set_tooltip_markup (child, markup);
}
示例#17
0
static void
megaphone_applet_update_contact (MegaphoneApplet *applet)
{
	MegaphoneAppletPriv *priv = GET_PRIV (applet);
	const gchar         *name;
	const gchar         *status;
	gchar               *tip;
	const gchar         *avatar_token = NULL;

	if (priv->contact) {
		EmpathyAvatar *avatar;

		avatar = empathy_contact_get_avatar (priv->contact);
		if (avatar) {
			avatar_token = avatar->token;
		}
	}

	if (avatar_token) {
		panel_applet_gconf_set_string (PANEL_APPLET (applet),
					       "avatar_token", avatar_token,
					       NULL);
	}

	megaphone_applet_update_icon (applet);

	if (priv->contact ) {
		name = empathy_contact_get_name (priv->contact);
		status = empathy_contact_get_status (priv->contact);
		tip = g_strdup_printf ("<b>%s</b>: %s", name, status);
		gtk_widget_set_tooltip_markup (GTK_WIDGET (applet), tip);
		g_free (tip);
	} else {
		gtk_widget_set_tooltip_markup (GTK_WIDGET (applet),
					       _("Please configure a contact."));
	}

}
示例#18
0
文件: gui_util.c 项目: bert/fped
GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm,
    const char *tooltip)
{
	GdkPixmap *pixmap;
	GdkBitmap *mask;
	GtkWidget *image;

	pixmap = gdk_pixmap_create_from_xpm_d(drawable, &mask, NULL, xpm);
	image = gtk_image_new_from_pixmap(pixmap, mask);
	gtk_misc_set_padding(GTK_MISC(image), 1, 1);
	if (tooltip)
		gtk_widget_set_tooltip_markup(image, tooltip);
	return image;
}
示例#19
0
/**
 * gimp_help_set_help_data_with_markup:
 * @widget:  The #GtkWidget you want to set a @tooltip and/or @help_id for.
 * @tooltip: The markup for this widget's tooltip (or %NULL).
 * @help_id: The @help_id for the #GtkTipsQuery tooltips inspector.
 *
 * Just like gimp_help_set_help_data(), but supports to pass text
 * which is marked up with <link linkend="PangoMarkupFormat">Pango
 * text markup language</link>.
 *
 * Since: 2.6
 **/
void
gimp_help_set_help_data_with_markup (GtkWidget   *widget,
                                     const gchar *tooltip,
                                     const gchar *help_id)
{
  g_return_if_fail (GTK_IS_WIDGET (widget));

  gtk_widget_set_tooltip_markup (widget, tooltip);

  if (GTK_IS_MENU_ITEM (widget))
    gimp_help_menu_item_set_tooltip (widget, tooltip, help_id);

  g_object_set_qdata (G_OBJECT (widget), GIMP_HELP_ID, (gpointer) help_id);
}
示例#20
0
static void _darkroom_ui_apply_style_popupmenu(GtkWidget *w, gpointer user_data)
{
  /* show styles popup menu */
  GList *styles = dt_styles_get_list("");
  GtkWidget *menu = NULL;
  if(styles)
  {
    menu= gtk_menu_new();
    do
    {
      dt_style_t *style=(dt_style_t *)styles->data;
      GtkWidget *mi=gtk_menu_item_new_with_label(style->name);

      char* items_string = dt_styles_get_item_list_as_string(style->name);
      gchar* tooltip = NULL;

      if((style->description) && strlen(style->description))
      {
        tooltip = g_strconcat("<b><i>", style->description, "</i></b>\n", items_string, NULL);
      }
      else
      {
        tooltip = g_strdup(items_string);
      }

      gtk_widget_set_tooltip_markup(mi, tooltip);

      gtk_menu_append (GTK_MENU (menu), mi);
      gtk_signal_connect_object (GTK_OBJECT (mi), "activate",
                                 GTK_SIGNAL_FUNC (_darkroom_ui_apply_style_activate_callback),
                                 (gpointer) g_strdup (style->name));
      gtk_widget_show (mi);

      g_free(style->name);
      g_free(style->description);
      g_free(style);
      g_free(items_string);
      g_free(tooltip);
    }
    while ((styles=g_list_next(styles))!=NULL);
  }

  /* if we got any styles, lets popup menu for selection */
  if (menu)
  {
    gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL,
                    0, 0);
  }
  else dt_control_log(_("no styles have been created yet"));
}
示例#21
0
static void remmina_file_editor_create_server(RemminaFileEditor* gfe, const RemminaProtocolSetting* setting, GtkWidget* table,
		gint row)
{
	RemminaProtocolPlugin* plugin = gfe->priv->plugin;
	GtkWidget* widget;
#ifdef HAVE_LIBAVAHI_UI
	GtkWidget* hbox;
#endif
	gchar* s;

	widget = gtk_label_new(_("Server"));
	gtk_widget_show(widget);
	gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5);
	gtk_table_attach(GTK_TABLE(table), widget, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);

	s = remmina_pref_get_recent(plugin->name);
	widget = remmina_public_create_combo_entry(s, remmina_file_get_string(gfe->priv->remmina_file, "server"), TRUE);
	gtk_widget_show(widget);
	gtk_widget_set_tooltip_markup(widget, _(server_tips));
	gtk_entry_set_activates_default(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget))), TRUE);
	gfe->priv->server_combo = widget;
	g_free(s);

#ifdef HAVE_LIBAVAHI_UI
	if (setting->opt1)
	{
		gfe->priv->avahi_service_type = (const gchar*) setting->opt1;

		hbox = gtk_hbox_new (FALSE, 0);
		gtk_widget_show(hbox);
		gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);

		widget = gtk_button_new_with_label ("...");
		s = g_strdup_printf(_("Browse the network to find a %s server"), plugin->name);
		gtk_widget_set_tooltip_text (widget, s);
		g_free(s);
		gtk_widget_show(widget);
		gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
		g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_file_editor_browse_avahi), gfe);

		gtk_table_attach_defaults (GTK_TABLE(table), hbox, 1, 2, row, row + 1);
	}
	else
#endif
	{
		gtk_table_attach_defaults(GTK_TABLE(table), widget, 1, 2, row, row + 1);
	}
}
示例#22
0
SelectionSetToolmenu::SelectionSetToolmenu() :
	_toolItem(gtk_tool_item_new()),
	_listStore(gtk_list_store_new(1, G_TYPE_STRING)),
	_clearSetsButton(NULL),
	_entry(gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(_listStore), 0))
{
	// Hbox containing all our items
	GtkWidget* hbox = gtk_hbox_new(FALSE, 3);
	gtk_container_add(GTK_CONTAINER(_toolItem), hbox);

	// Pack Label
	gtk_box_pack_start(GTK_BOX(hbox), 
		gtkutil::LeftAlignedLabel(_("Selection Set: ")), FALSE, FALSE, 0);

	// Pack Combo Box
	gtk_box_pack_start(GTK_BOX(hbox), _entry, TRUE, TRUE, 0);

	// Add tooltip
	gtk_widget_set_tooltip_markup(_entry, _(ENTRY_TOOLTIP));

	// Add clear button
	{
		GtkWidget* image = gtk_image_new_from_pixbuf(GlobalUIManager().getLocalPixbufWithMask("delete.png"));
		gtk_widget_show(image);

		_clearSetsButton = gtk_tool_button_new(image, _("Clear Selection Sets"));
		
		// Set tooltip
		gtk_tool_item_set_tooltip_text(_clearSetsButton, _("Clear Selection Sets"));

		// Connect event
		g_signal_connect(G_OBJECT(_clearSetsButton), "clicked", G_CALLBACK(onDeleteAllSetsClicked), this);

		gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(_clearSetsButton), FALSE, FALSE, 0);
	}

	// Connect the signals
	GtkWidget* childEntry = gtk_bin_get_child(GTK_BIN(_entry));
	g_signal_connect(G_OBJECT(childEntry), "activate", G_CALLBACK(onEntryActivated), this); 

	g_signal_connect(G_OBJECT(_entry), "changed", G_CALLBACK(onSelectionChanged), this);

	// Populate the list
	update();

	// Add self as observer
	GlobalSelectionSetManager().addObserver(*this);
}
示例#23
0
NotificationWidget::NotificationWidget(WLSignal *wls, WokXMLTag *tag) : WLSignalInstance(wls), 
origxml(new WokXMLTag(*tag))
{
	box = gtk_vbox_new(FALSE, 2);
	GtkWidget *label = gtk_label_new(tag->GetFirstTag("body").GetChildrenStr().c_str());
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
	
		
	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);	
	gtk_widget_set_tooltip_markup(box,tag->GetFirstTag("body").GetChildrenStr().c_str());
	
	std::list <WokXMLTag *> *com_list;
	std::list <WokXMLTag *>::iterator c_iter;
	
	com_list = &origxml->GetTagList("commands");
	for( c_iter = com_list->begin() ; c_iter != com_list->end() ; c_iter++ )
	{
		GtkWidget *bbox;
		GtkWidget *label;
		bbox = gtk_vbox_new(FALSE, 2);
		label = gtk_label_new((*c_iter)->GetAttr("name").c_str());
		gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
		
		gtk_box_pack_start(GTK_BOX(box), bbox, FALSE, FALSE, 0);
		gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
		
		std::list <WokXMLTag *> *list = &(*c_iter)->GetTagList("command");
		std::list <WokXMLTag *>::iterator iter;
		for ( iter = list->begin(); iter != list->end(); iter++)
		{
			GtkWidget *button = gtk_event_box_new();
			GtkWidget *label = gtk_label_new((*iter)->GetAttr("name").c_str());
			gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
		
			gtk_container_add(GTK_CONTAINER(button), label);
			
			gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
			g_object_set_data(G_OBJECT(button), "xml", *iter);
			
			g_signal_connect (button , "button-press-event",	G_CALLBACK (NotificationWidget::CommandExec),this);
		}
		
	}
	
}
示例#24
0
void fx_head_bind(FxMain* fxmain)
{
	FxHead* fxhead = fxmain->headPanel;
	User* user = fxmain->user;
	Config* config = user->config;
	char name[256];
	char tooltip[1024];
	char* statename = NULL;
	GdkPixbuf* portrait_pix = NULL;

	memset(fxhead->oldimpression, 0, sizeof(fxhead->oldimpression));

	snprintf(name, sizeof(name) - 1 , "<b>%s</b>"
			, user->nickname == NULL ? user->sId : g_markup_escape_text(user->nickname, -1) );

	gtk_label_set_markup(GTK_LABEL(fxhead->name_label), name );
	

	strcpy(fxhead->oldimpression
		, (strlen(user->impression) == 0 || user->impression == NULL)
		? _("Click here to input signature") : user->impression);

	sprintf(tooltip, "<b>%s</b>", g_markup_escape_text(user->impression, strlen(user->impression)));
	gtk_widget_set_tooltip_markup(fxhead->impre_label, tooltip);
	escape_impression(fxhead->oldimpression);
	gtk_label_set_text(GTK_LABEL(fxhead->impre_label), fxhead->oldimpression);

	sprintf(name , "%s/%s.jpg" , config->iconPath , user->sId);

	portrait_pix = gdk_pixbuf_new_from_file_at_size(name,
			USER_PORTRAIT_SIZE, USER_PORTRAIT_SIZE, NULL);
	if(! portrait_pix)
		portrait_pix = gdk_pixbuf_new_from_file_at_size(name,
				USER_PORTRAIT_SIZE, USER_PORTRAIT_SIZE, NULL);
	if(portrait_pix)
		gtk_image_set_from_pixbuf(GTK_IMAGE(fxhead->portrait) , portrait_pix);

	statename = fx_util_get_state_name(user->state);
	gtk_label_set_markup(GTK_LABEL(fxhead->state_label) , statename);
	fx_head_set_state_image(fxmain , user->state);

	free(statename);
}
示例#25
0
void    Amt::ObjConnImpl::activate__( const char* ){
	// stage one activation (after creation )
	_in_widget = gtk_vbox_new(0,0);
	status_label = gtk_label_new(NULL);
	gtk_label_set_markup(GTK_LABEL(status_label),"<span  foreground=\"#000099\" >О подключении объекта ничего не известно</span>");

	GtkWidget* _fv = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME ( _fv), GTK_SHADOW_ETCHED_OUT);
	gtk_container_add(GTK_CONTAINER(_fv), status_label);
        gtk_widget_set_tooltip_markup(_fv, "<b>Кликнуть левой кнопкой мыши  для открытия сводного графика.</b>" );

	GtkWidget* _event = gtk_event_box_new();
	gtk_container_add(GTK_CONTAINER(_event), _fv);
	g_signal_connect(G_OBJECT(_event), "button_press_event", G_CALLBACK(ButPressSt), this);

	gtk_box_pack_start(GTK_BOX(_in_widget), _event, 1,1,0);
    
	gtk_widget_show_all(_in_widget);
}
示例#26
0
int iupdrvBaseSetTipAttrib(Ihandle* ih, const char* value)
{
  GtkWidget* widget = (GtkWidget*)iupAttribGet(ih, "_IUP_EXTRAPARENT");
  if (!widget)
    widget = ih->handle;

#if GTK_CHECK_VERSION(2, 12, 0)
  if (iupAttribGetBoolean(ih, "TIPMARKUP"))
    gtk_widget_set_tooltip_markup(widget, iupgtkStrConvertToUTF8(value));
  else
    gtk_widget_set_tooltip_text(widget, iupgtkStrConvertToUTF8(value));

  g_signal_connect(widget, "query-tooltip", G_CALLBACK(gtkQueryTooltip), ih);
#else
  if (gtk_tips == NULL)
    gtk_tips = gtk_tooltips_new();

  gtk_tooltips_set_tip(gtk_tips, widget, iupgtkStrConvertToUTF8(value), NULL);
#endif

  return 1;
}
示例#27
0
static GSList *
do_filechooser (void)
{
  GSList *ret = NULL;
  GtkWidget *dialog;
  GtkWidget *ro_checkbutton;

  ret = NULL;

  dialog = gtk_file_chooser_dialog_new (_("Select Disk Image(s) to Mount"),
                                        NULL, /* parent window */
                                        GTK_FILE_CHOOSER_ACTION_OPEN,
                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
                                        _("_Mount"), GTK_RESPONSE_ACCEPT,
                                        NULL);
  gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (dialog),
                                                    TRUE,   /* set_file_types */
                                                    FALSE); /* allow_compressed */
  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);

  /* Add a RO check button that defaults to RO */
  ro_checkbutton = gtk_check_button_new_with_mnemonic (_("Set up _read-only mount"));
  gtk_widget_set_tooltip_markup (ro_checkbutton, _("If checked, the mount will be read-only. This is useful if you don’t want the underlying disk image to be modified"));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ro_checkbutton), !opt_writable);
  gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
  gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), ro_checkbutton);

  //gtk_widget_show_all (dialog);
  if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
    goto out;

  ret = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog));
  opt_writable = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ro_checkbutton));

 out:
  gtk_widget_destroy (dialog);
  return ret;
}
示例#28
0
gboolean fx_head_impre_activate_func(GtkWidget* widget , gpointer data)
{
	FxMain* fxmain = (FxMain*)data;
	FxHead* fxhead = fxmain->headPanel;

	gchar tooltip[1024];
	const gchar* impression = gtk_entry_get_text(GTK_ENTRY(widget));
	
	gtk_widget_show(fxhead->impre_box);
	gtk_widget_hide(widget);
	if(strcmp(impression , fxhead->oldimpression) == 0)
		return FALSE;
	if(fetion_user_set_moodphrase(fxmain->user , impression) > 0)
	{
		gtk_label_set_text(GTK_LABEL(fxhead->impre_label) , impression);
		memset(fxhead->oldimpression, 0, sizeof(fxhead->oldimpression));
		strcpy(fxhead->oldimpression , impression);
		memset(tooltip, 0, sizeof(tooltip));
		sprintf(tooltip , "<b>%s</b>" , g_markup_escape_text(impression, -1));
		gtk_widget_set_tooltip_markup(fxhead->impre_label , tooltip);
	}
	return TRUE;
}
示例#29
0
文件: finfo.c 项目: iuli09/RAle
static GtkWidget *
finfo_creeaza_buton(GtkWindow *fereastraParinte,
                    const gchar *textAfisat, fl_media_type tpImg, 
                    const gchar *textIndicatie, void (*fctClicked)(GtkWidget *, GtkWindow *)) {
  GtkWidget *btRezultat = NULL;						

  /* inițializări generale */
  btRezultat = gtk_button_new_with_label(textAfisat);
  gtk_button_set_relief(GTK_BUTTON(btRezultat), GTK_RELIEF_HALF);
  gtk_button_set_focus_on_click(GTK_BUTTON(btRezultat), FALSE);
  gtk_widget_set_tooltip_markup(btRezultat, textIndicatie);
  if(NULL != fctClicked) {
    g_signal_connect(btRezultat, "clicked", G_CALLBACK(fctClicked), fereastraParinte);
  }
  
  /* atașăm pictograma */
  GdkPixbuf *imgbtPixBuf = fl_obtine_imagine_media_scalata(tpImg, 16, 16);
  GtkWidget *imgbt = gtk_image_new_from_pixbuf(imgbtPixBuf);
  g_object_unref(imgbtPixBuf);
  gtk_button_set_image_position(GTK_BUTTON(btRezultat), GTK_POS_RIGHT);
  gtk_button_set_image(GTK_BUTTON(btRezultat), imgbt);
  
  return btRezultat;
}
示例#30
0
文件: user.c 项目: g7/fbpanel
static int
user_constructor(plugin_instance *p)
{
    user_priv *c G_GNUC_UNUSED = (user_priv *) p;
    gchar *image = NULL;
    gchar *icon = NULL;
    gchar *gravatar = NULL;

    ENTER;
    if (!(k = class_get("menu")))
        RET(0);
    XCG(p->xc, "image", &image, str);
    XCG(p->xc, "icon", &icon, str);
    if (!(image || icon))
        XCS(p->xc, "icon", "avatar-default", value);
    if (!PLUGIN_CLASS(k)->constructor(p))
        RET(0);
    XCG(p->xc, "gravataremail", &gravatar, str);
    DBG("gravatar email '%s'\n", gravatar);
    if (gravatar)
        g_timeout_add(300, fetch_gravatar, p);
    gtk_widget_set_tooltip_markup(p->pwid, "<b>User</b>");
    RET(1);
}