예제 #1
0
/* Info message */
static GtkWidget *get_info_message () {
  GtkWidget *page;
  GtkWidget *aboutwin;
  GtkWidget *text;

  /* Make the box */
  page = gtk_vbox_new (FALSE, 8);
  gtk_container_set_border_width (GTK_CONTAINER (page), 12);

  /* Window with info */
  aboutwin = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(aboutwin),
    GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(aboutwin), 
    GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX(page), aboutwin, TRUE, TRUE, 0);

  text = gtk_imhtml_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER(aboutwin), text);
  pidgin_setup_imhtml (text);

  /* Info text */
  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<b><u>Basic info</u></b><br>"), GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("A <b>widget</b> is a little piece/snippet of automatically "
      "generated text.  There are all sorts of widgets; each type has "
      "different content (i.e. a random quote, text from a blog, the "
      "song currently playing, etc).<br><br>"), GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("To use a widget, simply drag it from the list on the left and "
      "drop it into a profile or status message.  <i>It's that easy!</i>"
      "<br><br>"), GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<b>To edit your profile:</b> "
      "Use the \"Info/profile\" tab in this window.<br>"), 
    GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<b>To edit your available/away/status message:</b> "
      "Use the regular Purple interface built into the bottom of the buddy "
      "list.<br><br>"), GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<b><u>Advanced Tips</u></b><br>"), GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("You can insert a widget into a profile or status by typing its name.  "
      "To do this, just type \"[widget-name]\" wherever you want to "
      "place a widget (names of widgets are listed on the left).  <br><br>"
      "<b>You type:</b> The song I am playing now is [iTunesInfo].<br>"
      "<b>AutoProfile result:</b> The song I am playing now is "
      "The Beatles - Yellow Submarine.<br><br>"), GTK_IMHTML_NO_SCROLL);

  return page;
}
예제 #2
0
Gtk::VPaned *SendMsgDlgTab::setup_im_pane()
{
	Gtk::VPaned *paned;
	paned = Gtk::manage(new Gtk::VPaned);
	Gtk::VBox *vbox;
	vbox = Gtk::manage(new Gtk::VBox(false, 5));
	paned->pack1(*vbox, true, true);
	
	Gtk::ScrolledWindow *sw;
	sw = Gtk::manage(new Gtk::ScrolledWindow());
	sw->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
	sw->set_shadow_type(Gtk::SHADOW_IN);
	vbox->pack_start(*sw, true, true, 0);
	sw->set_size_request(230, 150);
	
	imhtml = gtk_imhtml_new(NULL, NULL);
	gtk_container_add(GTK_CONTAINER(sw->gobj()), imhtml);
	gtk_imhtml_show_comments(GTK_IMHTML(imhtml), true);
	
	Gtk::VBox *vbox2;
	vbox2 = Gtk::manage(new Gtk::VBox(false, 5));
	paned->pack2(*vbox2, false, false);
	
	Gtk::VBox *tool_vbox;
	tool_vbox = build_conv_toolbutton_vbox();
	
	vbox2->pack_start(*tool_vbox, false, false, 0);
	
	Gtk::Frame *frame;
	frame = Gtk::manage(new Gtk::Frame());
	frame->set_shadow_type(Gtk::SHADOW_IN);
	vbox2->pack_start(*frame, true, true, 0);
	
	m_input_textview.set_wrap_mode(Gtk::WRAP_WORD);
	m_input_textview.set_size_request(-1, 45);
	frame->add(m_input_textview);
	//m_input_textview.grab_focus();
	m_input_textview.signal_event().connect(SigC::slot(*this, &SendMsgDlgTab::on_input_textview_event));

	Gtk::HBox *hbox;
	hbox = Gtk::manage(new Gtk::HBox(false, 5));
	vbox2->pack_start(*hbox, false, false, 0);
	setup_im_buttons(hbox);
	
	return paned;
}
예제 #3
0
static void
create_console(PurplePluginAction *action)
{
	GtkWidget *vbox = gtk_vbox_new(FALSE, 6);
	GtkWidget *label;
	GtkTextBuffer *buffer;
	GtkWidget *toolbar;
	GList *connections;
	GtkToolItem *button;

	if (console) {
		gtk_window_present(GTK_WINDOW(console->window));
		return;
	}

	console = g_new0(XmppConsole, 1);

	console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE);
	g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL);
	gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400);
	gtk_container_add(GTK_CONTAINER(console->window), vbox);

	console->hbox = gtk_hbox_new(FALSE, 3);
	gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0);
	label = gtk_label_new(_("Account: "));
	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
	gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0);
	console->dropdown = gtk_combo_box_new_text();
	for (connections = purple_connections_get_all(); connections; connections = connections->next) {
		PurpleConnection *gc = connections->data;
		if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), "prpl-jabber")) {
			console->count++;
			console->accounts = g_list_append(console->accounts, gc);
			gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown),
						  purple_account_get_username(purple_connection_get_account(gc)));
			if (!console->gc)
				console->gc = gc;
		}
	}
	gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown),0);
	gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0);
	g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL);

	console->imhtml = gtk_imhtml_new(NULL, NULL);
	if (console->count == 0)
		gtk_imhtml_append_text(GTK_IMHTML(console->imhtml),
				       _("<font color='#c8c8c8'>Not connected to XMPP</font>"), 0);
	gtk_box_pack_start(GTK_BOX(vbox),
		pidgin_make_scrollable(console->imhtml, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1),
		TRUE, TRUE, 0);

	toolbar = gtk_toolbar_new();
	button = gtk_tool_button_new(NULL, "<iq/>");
	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL);
	gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));

	button = gtk_tool_button_new(NULL, "<presence/>");
	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL);
	gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));

	button = gtk_tool_button_new(NULL, "<message/>");
	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL);
	gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));

	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);

	console->entry = gtk_imhtml_new(NULL, NULL);
	gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(console->entry), TRUE);
	g_signal_connect(G_OBJECT(console->entry),"message_send", G_CALLBACK(message_send_cb), console);

	console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1);
	gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0);
	gtk_imhtml_set_editable(GTK_IMHTML(console->entry), TRUE);
	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry));
	g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(entry_changed_cb), NULL);

	entry_changed_cb(buffer, NULL);

	gtk_widget_show_all(console->window);
	if (console->count < 2)
		gtk_widget_hide(console->hbox);
}
예제 #4
0
파일: away.c 프로젝트: catalinmiron/misc
void do_away_message(GtkWidget *w, struct away_message *a)
{
	GtkWidget *back;
	GtkWidget *edit;
	GtkWidget *awaytext;
	GtkWidget *sw;
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;
	char *buf;

	if (!a)
		return;

	if(imaway)
		gtk_widget_destroy(imaway);

	GAIM_DIALOG(imaway);
	gtk_window_set_role(GTK_WINDOW(imaway), "imaway");
	if (strlen(a->name))
		gtk_window_set_title(GTK_WINDOW(imaway), a->name);
	else
		gtk_window_set_title(GTK_WINDOW(imaway), _("Away!"));
	g_signal_connect(G_OBJECT(imaway), "destroy",
			G_CALLBACK(do_im_back), imaway);

	vbox = gtk_vbox_new(FALSE, 5);
	gtk_container_add(GTK_CONTAINER(imaway), vbox);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
	gtk_widget_show(vbox);

	hbox = gtk_hbox_new(FALSE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 0);
	gtk_widget_show(hbox);

	sw = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER,
			GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
	gtk_widget_set_size_request(sw, 245, 120);
	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
	gtk_widget_show(sw);

	awaytext = gtk_imhtml_new(NULL, NULL);
	gtk_container_add(GTK_CONTAINER(sw), awaytext);
	gaim_setup_imhtml(awaytext);
	gtk_widget_show(awaytext);
	buf = stylize(a->message, BUF_LONG);
	gtk_imhtml_append_text(GTK_IMHTML(awaytext), buf, GTK_IMHTML_NO_TITLE |
			GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
	g_free(buf);
	gtk_imhtml_append_text(GTK_IMHTML(awaytext), "<BR>",
			GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_COMMENTS |
			GTK_IMHTML_NO_SCROLL);

	awayqueuesw = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(awayqueuesw),
			GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(awayqueuesw),
			GTK_SHADOW_IN);
	gtk_box_pack_start(GTK_BOX(vbox), awayqueuesw, TRUE, TRUE, 0);

	awayqueuestore = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
	awayqueue = gtk_tree_view_new_with_model(GTK_TREE_MODEL(awayqueuestore));
	renderer = gtk_cell_renderer_text_new();

	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(awayqueue), FALSE);
	column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
			"text", 0,
			NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column);
	column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
			"text", 1,
			NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column);
	column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
			"text", 2,
			NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(awayqueue), column);

	gtk_container_add(GTK_CONTAINER(awayqueuesw), awayqueue);

	g_signal_connect(G_OBJECT(awayqueue), "button_press_event", G_CALLBACK(dequeue_cb), NULL);


	if (gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) {
		gtk_widget_show(awayqueuesw);
		gtk_widget_show(awayqueue);
	}

	awaymessage = a;

	edit = gaim_pixbuf_button_from_stock(_("Edit This Message"), GTK_STOCK_CONVERT, GAIM_BUTTON_HORIZONTAL);
	gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0);
	g_signal_connect(G_OBJECT(edit), "clicked", G_CALLBACK(create_away_mess), awaymessage);
	gtk_widget_show(edit);

	back = gaim_pixbuf_button_from_stock(_("I'm Back!"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL);
	gtk_box_pack_start(GTK_BOX(hbox), back, TRUE, TRUE, 0);
	g_signal_connect(G_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway);
	gtk_window_set_focus(GTK_WINDOW(imaway), back);
	gtk_widget_show(back);

	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

	gtk_widget_show(imaway);
	serv_set_away_all(awaymessage->message);
}
예제 #5
0
/*--------------------------------------------------------------------------*
 * Create the main window                                                   *
 *--------------------------------------------------------------------------*/
static void create_dialog () {
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkTreeSelection *selection;
  GtkWidget *message_list_view;
  
  GtkWidget *vbox, *vpane, *hbox, *config_vbox;
  GtkWidget *sw, *imhtml, *msg_window, *button;

  imhtml = gtk_imhtml_new (NULL, NULL);
  
  /* Create main display window */
  dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_type_hint (GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_title (GTK_WINDOW(dialog), _("AutoProfile Summary"));
  gtk_widget_realize (dialog);

  vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_add (GTK_CONTAINER (dialog), vbox);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);

  /* Set up progress bar container */
  progress_create (AP_UPDATE_PROFILE, vbox);
  progress_create (AP_UPDATE_STATUS, vbox);

  /* Set up list of past away messages */
  vpane = gtk_vpaned_new ();
  gtk_box_pack_start (GTK_BOX(vbox), vpane, TRUE, TRUE, 0);
  
  message_list = gtk_list_store_new (4, 
    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
  message_list_view = gtk_tree_view_new_with_model (
    GTK_TREE_MODEL (message_list));
  renderer = gtk_cell_renderer_text_new ();

  column = gtk_tree_view_column_new_with_attributes (
    _("Time"), renderer, "markup", 0, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sort_column_id (column, 0);

  column = gtk_tree_view_column_new_with_attributes (
    _("Type"), renderer, "markup", 1, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sort_column_id (column, 1);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);

  column = gtk_tree_view_column_new_with_attributes (
    _("Text"), renderer, "markup", 2, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);

  sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), 
    GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), 
    GTK_SHADOW_IN);

  gtk_container_add (GTK_CONTAINER (sw), message_list_view);
  gtk_paned_add1 (GTK_PANED(vpane), sw);
 
  selection = gtk_tree_view_get_selection (
    GTK_TREE_VIEW (message_list_view));
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
  g_signal_connect (G_OBJECT (selection), "changed",
                    G_CALLBACK (display_diff_msg), imhtml);

  /* Set up the window to display away message in */
  msg_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(msg_window), 
    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(msg_window), 
    GTK_SHADOW_IN);
  gtk_paned_add2 (GTK_PANED(vpane), msg_window);
 
  gtk_container_add (GTK_CONTAINER(msg_window), imhtml);
  pidgin_setup_imhtml (imhtml);
 
  /* Bottom area */
  hbox = gtk_hbox_new (FALSE, 6);
  gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  config_vbox = gtk_vbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX(hbox), config_vbox, TRUE, TRUE, 0);
 
  pidgin_prefs_checkbox (
    _("Queue new messages while away"),
    "/plugins/gtk/autoprofile/queue_messages_when_away", 
    config_vbox);

  button = pidgin_prefs_checkbox (
    _("Play sounds while away"),
    "/purple/sound/while_away",
    config_vbox);
  sound_pref_cb = purple_prefs_connect_callback (ap_get_plugin_handle (), 
    "/purple/sound/while_away", sound_cb, button);

  gtk_box_pack_start (GTK_BOX(hbox), gtk_vseparator_new (), FALSE, FALSE, 0);

  config_vbox = gtk_vbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX(hbox), config_vbox, TRUE, TRUE, 0);
  
  ap_gtk_prefs_add_summary_option (config_vbox);

  button = gtk_button_new_with_label (_("Hide summary now"));  
  gtk_box_pack_start (GTK_BOX(config_vbox), button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hide_cb), NULL);

  /* Finish up */
  g_signal_connect (G_OBJECT(dialog), "delete-event",
    G_CALLBACK(gtk_widget_hide_on_delete), NULL);
  gtk_paned_set_position (GTK_PANED(vpane), 250);
  gtk_window_set_default_size (GTK_WINDOW(dialog), 430, 430);
}
예제 #6
0
static void *
gaim_gtk_notify_formatted(const char *title, const char *primary,
                          const char *secondary, const char *text,
                          GCallback cb, void *user_data)
{
    GtkWidget *window;
    GtkWidget *vbox;
    GtkWidget *label;
    GtkWidget *button;
    GtkWidget *imhtml;
    GtkWidget *sw;
    int options = 0;
    char label_text[2048];
    char *linked_text;

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), title);
    gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_container_set_border_width(GTK_CONTAINER(window), 12);

    g_signal_connect(G_OBJECT(window), "delete_event",
                     G_CALLBACK(formatted_close_cb), NULL);

    /* Setup the main vbox */
    vbox = gtk_vbox_new(FALSE, 12);
    gtk_container_add(GTK_CONTAINER(window), vbox);
    gtk_widget_show(vbox);

    /* Setup the descriptive label */
    g_snprintf(label_text, sizeof(label_text),
               "<span weight=\"bold\" size=\"larger\">%s</span>%s%s",
               primary,
               (secondary ? "\n" : ""),
               (secondary ? secondary : ""));

    label = gtk_label_new(NULL);

    gtk_label_set_markup(GTK_LABEL(label), label_text);
    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
    gtk_widget_show(label);

    /* Setup the scrolled window that we're putting the gtkimhtml in. */
    sw = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
                                   GTK_POLICY_NEVER,
                                   GTK_POLICY_ALWAYS);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
                                        GTK_SHADOW_IN);
    gtk_widget_set_size_request(sw, 300, 250);
    gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
    gtk_widget_show(sw);

    /* Now build that gtkimhtml */
    imhtml = gtk_imhtml_new(NULL, NULL);
    gtk_widget_set_name(imhtml, "gaim_gtknotify_imhtml");
    gtk_container_add(GTK_CONTAINER(sw), imhtml);
    gtk_widget_show(imhtml);
    gaim_setup_imhtml(imhtml);

    /* Add the Close button. */
    button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);

    g_signal_connect_swapped(G_OBJECT(button), "clicked",
                             G_CALLBACK(formatted_close_cb), window);
    g_signal_connect(G_OBJECT(window), "key_press_event",
                     G_CALLBACK(formatted_input_cb), NULL);


    /* Add the text to the gtkimhtml */
    if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
        options ^= GTK_IMHTML_NO_COLOURS;
    if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
        options ^= GTK_IMHTML_NO_FONTS;
    if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
        options ^= GTK_IMHTML_NO_SIZES;

    options ^= GTK_IMHTML_NO_COMMENTS;
    options ^= GTK_IMHTML_NO_TITLE;
    options ^= GTK_IMHTML_NO_NEWLINE;
    options ^= GTK_IMHTML_NO_SCROLL;

    /* Make sure URLs are clickable */
    linked_text = gaim_markup_linkify(text);
    gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text,
                           options);
    g_free(linked_text);

    /* Show the window */
    gtk_widget_show(window);

    return window;
}
예제 #7
0
/* Widget configuration menu */
static GtkWidget *get_widget_configuration (struct widget *w) {
  GtkWidget *config, *hbox, *vbox, *sw;
  GtkWidget *label, *button;
  GtkWidget *menu;
  GString *s;
  gchar *output;
  
  config = gtk_vbox_new (FALSE, 0);
 
  /* Title/Description */
  hbox = gtk_hbox_new (FALSE, 8);
  gtk_container_set_border_width (GTK_CONTAINER(hbox), 6);
  gtk_box_pack_start (GTK_BOX(config), hbox, FALSE, FALSE, 0);

  s = g_string_new ("");
  g_string_printf (s, "<b>%s:</b> %s", w->component->name, 
    w->component->description);
  label = gtk_label_new ("");
  gtk_label_set_markup (GTK_LABEL(label), s->str);
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
  g_string_free (s, TRUE); 

  /* Separator */
  gtk_box_pack_start (GTK_BOX (config), gtk_hseparator_new (),
    FALSE, FALSE, 0);
 
  /* Preview window */
  vbox = gtk_vbox_new (FALSE, 6);
  gtk_container_set_border_width (GTK_CONTAINER(vbox), 6);
  gtk_box_pack_start (GTK_BOX(config), vbox, FALSE, FALSE, 0);

  hbox = gtk_hbox_new (FALSE, 8);
  gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  label = gtk_label_new ("");
  gtk_label_set_markup (GTK_LABEL(label), _("<b>Preview</b>"));
  gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);

  button = gtk_button_new_with_label (_("Refresh"));
  gtk_box_pack_end (GTK_BOX(hbox), button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (refresh_cb), w);

  sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw),
    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), 
    GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX(vbox), sw, TRUE, TRUE, 0);

  dialog_box_preview = gtk_imhtml_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER(sw), dialog_box_preview);
  pidgin_setup_imhtml (dialog_box_preview);
  output = w->component->generate (w);
  gtk_imhtml_append_text (GTK_IMHTML(dialog_box_preview),
    output, GTK_IMHTML_NO_SCROLL);
  free (output);
  dialog_box_widget = w;

  /* Separator */
  gtk_box_pack_start (GTK_BOX (config), gtk_hseparator_new (),
    FALSE, FALSE, 0);

  /* Configuration stuff */
  vbox = gtk_vbox_new (FALSE, 8);
  gtk_container_set_border_width (GTK_CONTAINER(vbox), 6);
  gtk_box_pack_start (GTK_BOX(config), vbox, TRUE, TRUE, 0);

  label = gtk_label_new ("");
  gtk_label_set_markup (GTK_LABEL(label), _("<b>Configuration</b>"));
  gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0);

  if (w->component->pref_menu == NULL ||
      (menu = (w->component->pref_menu) (w)) == NULL) {
    label = gtk_label_new (_("No options available for this component"));
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  } else {
    gtk_box_pack_start (GTK_BOX (vbox), menu, TRUE, TRUE, 0);
  }

  return config;
}
예제 #8
0
/*--------------------------------------------------------------------------*
 * Info Tab                                                                 *
 *--------------------------------------------------------------------------*/
static GtkWidget *get_info_page () {
  GtkWidget *page;
  GtkWidget *label;
  GtkWidget *aboutwin;
  GtkWidget *text;

  gchar *labeltext, *str;

  /* Make the box */
  page = gtk_vbox_new (FALSE, 5);
  gtk_container_set_border_width (GTK_CONTAINER (page), 5);

  /* AutoProfile title */
  labeltext = g_strdup_printf (
    _("<span weight=\"bold\" size=\"larger\">AutoProfile %s</span>"),
    PP_VERSION);
  label = gtk_label_new (NULL);
  gtk_label_set_markup (GTK_LABEL(label), labeltext);
  gtk_label_set_line_wrap (GTK_LABEL(label), TRUE);
  gtk_misc_set_alignment (GTK_MISC(label), 0.5, 0);
  gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 0);
  g_free(labeltext);

  /* Window with info */
  aboutwin = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(aboutwin),
    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(aboutwin), 
    GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX(page), aboutwin, TRUE, TRUE, 0);

  text = gtk_imhtml_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER(aboutwin), text);
  pidgin_setup_imhtml (text);

  /* Info text */
  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("Use the <b>Autoprofile</b> portion of the <b>Tools</b> "
      "menu in the <b>"
      "buddy list</b> to configure the actual content that will go in your "
      "status messages and profiles and set options.<br><br>"),
    GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<u>DOCUMENTATION / HELP</u><br>"), GTK_IMHTML_NO_SCROLL);
  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("Complete documentation can be found at:<br> <a href="
    "\"http://hkn.eecs.berkeley.edu/~casey/autoprofile/documentation.php\">"
    "hkn.eecs.berkeley.edu/~casey/autoprofile/documentation.php</a><br>"),
    GTK_IMHTML_NO_SCROLL);

  gtk_imhtml_append_text (GTK_IMHTML(text),
    _("<br><u>ABOUT</u><br>"), GTK_IMHTML_NO_SCROLL);

  str = g_strconcat(
    "<font size=\"3\"><b>", _("Developers"), ":</b></font><br>"
    "  Casey Ho (Lead Developer)<br>"
    "  Mitchell Harwell<br>", NULL);
  gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL);
  g_free(str);

  str = g_strconcat(
    "<font size=\"3\"><b>", _("Contributors/Patchers"), ":</b></font><br>"
    "  Onime Clement<br>"
    "  Michael Milligan<br>"
    "  Mark Painter<br>", NULL);
  gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL);
  g_free(str);

  str = g_strconcat(
    "<font size=\"3\"><b>", _("Website"), ":</b></font><br>"
    "  <a href=\"http://autoprofile.sourceforge.net\">"
    "autoprofile.sourceforge.net<br>", NULL);
  gtk_imhtml_append_text(GTK_IMHTML(text), str, GTK_IMHTML_NO_SCROLL);
  g_free(str);

  return page;
}
예제 #9
0
static DebugWindow *
debug_window_new(void)
{
	DebugWindow *win;
	GtkWidget *vbox;
	GtkWidget *toolbar;
	GtkWidget *sw;
	GtkWidget *button;
	GtkWidget *image;
	int width, height;

	win = g_new0(DebugWindow, 1);

	width  = gaim_prefs_get_int("/gaim/gtk/debug/width");
	height = gaim_prefs_get_int("/gaim/gtk/debug/height");

	GAIM_DIALOG(win->window);
	gaim_debug(GAIM_DEBUG_INFO, "gtkdebug", "Setting dimensions to %d, %d\n",
			   width, height);

	gtk_window_set_default_size(GTK_WINDOW(win->window), width, height);
	gtk_window_set_role(GTK_WINDOW(win->window), "debug");
	gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window"));

	g_signal_connect(G_OBJECT(win->window), "delete_event",
					 G_CALLBACK(debug_window_destroy), NULL);
	g_signal_connect(G_OBJECT(win->window), "configure_event",
					 G_CALLBACK(configure_cb), win);

	/* Setup the vbox */
	vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(win->window), vbox);

	if (gaim_prefs_get_bool("/gaim/gtk/debug/toolbar")) {
		/* Setup our top button bar thingie. */
		toolbar = gtk_toolbar_new();
		gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ);
		gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar),
								  GTK_ICON_SIZE_SMALL_TOOLBAR);

		gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);

		/* Find button */
		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND,
								 NULL, NULL, G_CALLBACK(find_cb), win, -1);

		/* Save */
		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE,
								 NULL, NULL, G_CALLBACK(save_cb), win, -1);

		/* Clear button */
		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR,
								 NULL, NULL, G_CALLBACK(clear_cb), win, -1);

		gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);

		/* Pause */
		image = gtk_image_new_from_stock(GAIM_STOCK_PAUSE, GTK_ICON_SIZE_MENU);
		button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
											GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
											NULL, _("Pause"), NULL, NULL,
											image, G_CALLBACK(pause_cb), win);

		/* Timestamps */
		button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
											GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
											NULL, _("Timestamps"), NULL, NULL,
											NULL, G_CALLBACK(timestamps_cb),
											win);

		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
						gaim_prefs_get_bool("/gaim/gtk/debug/timestamps"));

		win->timestamps_handle =
			gaim_prefs_connect_callback("/gaim/gtk/debug/timestamps",
										timestamps_pref_cb, button);
	}

	/* Now our scrolled window... */
	sw = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
								   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
										GTK_SHADOW_IN);

	/* ... which has a gtkimhtml in it. */
	win->text = gtk_imhtml_new(NULL, NULL);

	gtk_container_add(GTK_CONTAINER(sw), win->text);

	/* Pack it in... Not like that, sicko. */
	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);

	gtk_widget_show_all(win->window);

	return win;
}