Exemplo n.º 1
0
void wxHyperlinkCtrl::SetURL(const wxString &uri)
{
    if ( UseNative() )
        gtk_link_button_set_uri(GTK_LINK_BUTTON(m_widget), wxGTK_CONV(uri));
    else
        wxGenericHyperlinkCtrl::SetURL(uri);
}
Exemplo n.º 2
0
void
set_open_web_button(GtkWidget *web_link_button)
{
	gchar *web_url = g_strconcat(config->base_url, settings->server_port, NULL);
	gtk_link_button_set_uri(GTK_LINK_BUTTON(web_link_button), web_url);

}
Exemplo n.º 3
0
static gboolean permission_checker_thread (gpointer data) {
    if (permission_check_requested == TRUE) {
        //the answer hasn't arrived yet
        return TRUE;

    } else {
        //the answer has arrived
        g_assert(perm_result != PERMISSION_UNKNOWN);

        if (perm_result == PERMISSION_ALLOWED) {
            gtk_image_set_from_stock(GTK_IMAGE(permission_status_icon), GTK_STOCK_YES, GTK_ICON_SIZE_SMALL_TOOLBAR);

            gchar *markup = g_markup_printf_escaped(_("OK. Scrobbling for user: %s"), username);

            gtk_label_set_markup(GTK_LABEL(permission_status_label), markup);
            gtk_widget_set_sensitive(revoke_button, TRUE);

        } else if (perm_result == PERMISSION_DENIED) {

            gtk_image_set_from_stock(GTK_IMAGE(permission_status_icon),  GTK_STOCK_NO,   GTK_ICON_SIZE_SMALL_TOOLBAR);
            gtk_image_set_from_stock(GTK_IMAGE(additional_details_icon), GTK_STOCK_INFO, GTK_ICON_SIZE_SMALL_TOOLBAR);


            gtk_label_set_label(GTK_LABEL(permission_status_label), _("Permission Denied"));

            gtk_label_set_markup(GTK_LABEL(details_label_first), _("Access the following link to allow Audacious to scrobble your plays:"));

            gchar *url = g_markup_printf_escaped("http://www.last.fm/api/auth/?api_key=%s&token=%s", SCROBBLER_API_KEY, request_token);

            gtk_link_button_set_uri(GTK_LINK_BUTTON(url_button), url);
            gtk_button_set_label(GTK_BUTTON(url_button), url);
            gtk_widget_show(url_button);
            g_free(url);

            gtk_label_set_markup(GTK_LABEL(details_label_second), _("Keep this window open and click 'Check Permission' again.\n"));

            gtk_label_set_label(GTK_LABEL(additional_details_label),
                                _("Don't worry. Your scrobbles are saved on your computer.\n"
                                  "They will be submitted as soon as Audacious is allowed to do so."));

        } else if (perm_result == PERMISSION_NONET) {
            gtk_image_set_from_stock(GTK_IMAGE(permission_status_icon),  GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
            gtk_image_set_from_stock(GTK_IMAGE(additional_details_icon), GTK_STOCK_INFO, GTK_ICON_SIZE_SMALL_TOOLBAR);


            gtk_label_set_label(GTK_LABEL(permission_status_label), _("Network Problem."));
            gtk_label_set_label(GTK_LABEL(details_label_first),     _("There was a problem contacting Last.fm. Please try again later."));
            gtk_label_set_label(GTK_LABEL(additional_details_label),
                    _("Don't worry. Your scrobbles are saved on your computer.\n"
                      "They will be submitted as soon as Audacious is allowed to do so."));
        }

        perm_result = PERMISSION_UNKNOWN;
        gtk_widget_set_sensitive(button, TRUE);

        return FALSE;
    }
}
Exemplo n.º 4
0
static void
tips_dialog_set_tip (GimpTip *tip)
{
  g_return_if_fail (tip != NULL);

  gtk_label_set_markup (GTK_LABEL (tip_label), tip->text);

  /*  set the URI to unset the "visited" state  */
  gtk_link_button_set_uri (GTK_LINK_BUTTON (more_button),
                           "http://docs.gimp.org/");

  gtk_widget_set_sensitive (more_button, tip->help_id != NULL);
}
Exemplo n.º 5
0
static void
on_item_selection_changed (GtkTreeSelection *selection,
                           ReaderItemsView *view)
{
	int read;
	gchar *url;
	gchar *title;
	gchar *contents;
	gchar *str_date;
	GtkTreeIter iter;
	GtkTreePath *path;
	GtkTreeModel *model;
	GDateTime *date;
	ReaderItemsViewPrivate *priv;

	priv = reader_items_view_get_instance_private (view);

	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
		path = gtk_tree_model_get_path (model, &iter);

		if (gtk_tree_path_get_depth (path) != 1) {
			gtk_tree_model_get (model, &iter,
						ITEM_COLUMN_CONTENTS, &contents,
						ITEM_COLUMN_TITLE, &title,
						ITEM_COLUMN_TIME, &date,
						ITEM_COLUMN_URL, &url,
						ITEM_COLUMN_READ, &read, -1);

			gtk_stack_set_visible_child_name (GTK_STACK (priv->webstack), "webcontents");

			gtk_button_set_label (GTK_BUTTON (priv->title), title);
			gtk_link_button_set_uri (priv->title, url);

			str_date = g_date_time_format (date, "%c");
			gtk_label_set_text (priv->date, str_date);
			g_free (str_date);

			webkit_web_view_load_html (priv->webview, contents, NULL);

			g_free (title);
			g_free (url);
			g_free (contents);

			if (read == UNREAD_FONT_WEIGHT)
				gtk_tree_store_set (GTK_TREE_STORE (model), &iter, ITEM_COLUMN_READ, READ_FONT_WEIGHT, -1);
		}

		gtk_tree_path_free (path);
	}
}
Exemplo n.º 6
0
/** set info */
void ui_info_hardware_set(
        NiftyconfHardware * hardware)
{
        LedHardware *h = hardware_niftyled(hardware);

        gtk_link_button_set_uri(GTK_LINK_BUTTON(UI("linkbutton_family")),
                                led_hardware_plugin_get_url(h));
        gtk_button_set_label(GTK_BUTTON(UI("linkbutton_family")),
                             led_hardware_plugin_get_family(h));
        gtk_label_set_text(GTK_LABEL(UI("label_description")),
                           led_hardware_plugin_get_description(h));
        gtk_label_set_text(GTK_LABEL(UI("label_author")),
                           led_hardware_plugin_get_author(h));
        gtk_label_set_text(GTK_LABEL(UI("label_license")),
                           led_hardware_plugin_get_license(h));
        gchar version[64];
        g_snprintf(version, sizeof(version), "v%d.%d.%d",
                   led_hardware_plugin_get_version_major(h),
                   led_hardware_plugin_get_version_minor(h),
                   led_hardware_plugin_get_version_micro(h));
        gtk_label_set_text(GTK_LABEL(UI("label_version")), version);
}
Exemplo n.º 7
0
/*
 * Dispaly the up-to-date status of the software. If a new release is available
 * display information about it.
 */
static gboolean version_info_show(gpointer data)
{
    Dialogs *_dialogs = (data) ? (Dialogs *)data : &dialogs;
    GtkBuilder *builder = _dialogs->builder;
    GtkWidget *r_name, *r_link, *r_dld_link;
    GtkWidget *internal_vbox;
    gchar *buf;

    /* don't bother showing the dialog if version check failed (applies only at startup) */
    if (!release && !data)
        return false;

    gdk_threads_enter();
    internal_vbox = GTK_WIDGET(gtk_builder_get_object(builder,
                               "msg_dialog_vbox"));

    if (!release) {
        g_object_set(G_OBJECT(_dialogs->latest_version), "text",
                     "Failed to get the latest version."
                     "Make sure you have an internet connection.",
                     NULL);
        gtk_widget_hide(internal_vbox);
    } else if (strncmp(GIT_VERSION, release->commit, 7)) {

        if (date_compare_against_build_date(release->build_date) > 0) {
            g_object_set(G_OBJECT(_dialogs->latest_version), "text",
                         "A new version is available", NULL);
        } else {
            /* No data means that a silent version checking has been
               requested. The progress bar has already been hidden
               and so should the message dialog be. */
            if (!data)
                goto end;
            g_object_set(G_OBJECT(_dialogs->latest_version), "text",
                         "This software is newer than the latest release",
                         NULL);
        }

        r_name = GTK_WIDGET(gtk_builder_get_object(builder,
                            "latest_version_name"));
        r_link = GTK_WIDGET(gtk_builder_get_object(builder,
                            "latest_version_link"));
        r_dld_link = GTK_WIDGET(gtk_builder_get_object(builder,
                                "latest_version_donwnload_link"));

        buf = g_strdup_printf("<b>%s</b>", release->name);
        gtk_label_set_markup(GTK_LABEL(r_name), buf);
        g_free(buf);
        gtk_link_button_set_uri(GTK_LINK_BUTTON(r_link), release->url);
        gtk_link_button_set_uri(GTK_LINK_BUTTON(r_dld_link),
                                release->windows_dld_url);
#ifndef __MINGW32__
        gtk_widget_hide(r_dld_link);
#endif

        gtk_widget_show(internal_vbox);
    } else {
        /* No data means that a silent version checking has been
           requested. The progress bar has already been hidden and so
           should the message dialog be. */
        if (!data)
            goto end;
        g_object_set(G_OBJECT(_dialogs->latest_version), "text",
                     "This software is up to date", NULL);
        gtk_widget_hide(internal_vbox);
    }

    release_dispose(release);
    release = NULL;


    gtk_widget_set_visible(GTK_WIDGET(gtk_builder_get_object(builder,
                                      "version_check_dont_show_again")), !data);

    gtk_dialog_run(GTK_DIALOG(_dialogs->latest_version));
    gtk_widget_hide(_dialogs->latest_version);

end:
    gdk_threads_leave();

    return false;
}
void
desktop_init (AppearanceData *data,
	      const gchar **uris)
{
  GtkWidget *add_button, *w;
  GtkCellRenderer *cr;
  char *url;

  data->wp_update_settings = TRUE;

  data->wp_uris = NULL;
  if (uris != NULL) {
    while (*uris != NULL) {
      data->wp_uris = g_slist_append (data->wp_uris, g_strdup (*uris));
      uris++;
    }
  }

  w = appearance_capplet_get_widget (data, "more_backgrounds_linkbutton");
  url = g_settings_get_string (data->settings, MORE_BACKGROUNDS_URL_KEY);
  if (url != NULL && url[0] != '\0') {
    gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
    gtk_widget_show (w);
  } else {
    gtk_widget_hide (w);
  }
  g_free (url);

  data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);

  g_signal_connect (data->wp_settings,
                           "changed::" WP_FILE_KEY,
                           G_CALLBACK (wp_file_changed),
                           data);
  g_signal_connect (data->wp_settings,
                           "changed::" WP_OPTIONS_KEY,
                           G_CALLBACK (wp_options_changed),
                           data);
  g_signal_connect (data->wp_settings,
                           "changed::" WP_SHADING_KEY,
                           G_CALLBACK (wp_shading_changed),
                           data);
  g_signal_connect (data->wp_settings,
                           "changed::" WP_PCOLOR_KEY,
                           G_CALLBACK (wp_color1_changed),
                           data);
  g_signal_connect (data->wp_settings,
                           "changed::" WP_SCOLOR_KEY,
                           G_CALLBACK (wp_color2_changed),
                           data);

  data->wp_model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF,
                                                       G_TYPE_POINTER));

  data->wp_view = GTK_ICON_VIEW (appearance_capplet_get_widget (data, "wp_view"));
  gtk_icon_view_set_model (data->wp_view, GTK_TREE_MODEL (data->wp_model));

  g_signal_connect_after (data->wp_view, "realize",
                          (GCallback) wp_select_after_realize, data);

  gtk_cell_layout_clear (GTK_CELL_LAYOUT (data->wp_view));

  cr = gtk_cell_renderer_pixbuf_new ();
  g_object_set (cr, "xpad", 5, "ypad", 5, NULL);

  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (data->wp_view), cr, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (data->wp_view), cr,
                                  "pixbuf", 0,
                                  NULL);

  cr = gtk_cell_renderer_pixbuf_new ();
  create_button_images (data);
  g_object_set (cr,
                "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
                "pixbuf", buttons[0],
                NULL);
  g_object_set_data (G_OBJECT (cr), "buttons", GINT_TO_POINTER (TRUE));

  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (data->wp_view), cr, FALSE);
  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (data->wp_view), cr,
                                      buttons_cell_data_func, data, NULL);
  g_signal_connect (data->wp_view, "selection-changed",
                    (GCallback) wp_selected_changed_cb, data);
  g_signal_connect (data->wp_view, "button-press-event",
                    G_CALLBACK (wp_button_press_cb), data);

  data->frame = -1;

  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (data->wp_model), 1,
                                   (GtkTreeIterCompareFunc) wp_list_sort,
                                   data, NULL);

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (data->wp_model),
                                        1, GTK_SORT_ASCENDING);

  gtk_drag_dest_set (GTK_WIDGET (data->wp_view), GTK_DEST_DEFAULT_ALL, drop_types,
                     G_N_ELEMENTS (drop_types), GDK_ACTION_COPY | GDK_ACTION_MOVE);
  g_signal_connect (data->wp_view, "drag_data_received",
                    (GCallback) wp_drag_received, data);

  gtk_drag_source_set (GTK_WIDGET (data->wp_view), GDK_BUTTON1_MASK,
                       drag_types, G_N_ELEMENTS (drag_types), GDK_ACTION_COPY);
  g_signal_connect (data->wp_view, "drag-data-get",
		    (GCallback) wp_drag_get_data, data);

  data->wp_style_menu = appearance_capplet_get_widget (data, "wp_style_menu");

  g_signal_connect (data->wp_style_menu, "changed",
                    (GCallback) wp_scale_type_changed, data);

  data->wp_color_menu = appearance_capplet_get_widget (data, "wp_color_menu");

  g_signal_connect (data->wp_color_menu, "changed",
                    (GCallback) wp_shade_type_changed, data);

  data->wp_scpicker = appearance_capplet_get_widget (data, "wp_scpicker");

  g_signal_connect (data->wp_scpicker, "color-set",
                    (GCallback) wp_scolor_changed, data);

  data->wp_pcpicker = appearance_capplet_get_widget (data, "wp_pcpicker");

  g_signal_connect (data->wp_pcpicker, "color-set",
                    (GCallback) wp_scolor_changed, data);

  add_button = appearance_capplet_get_widget (data, "wp_add_button");
  gtk_button_set_image (GTK_BUTTON (add_button),
                        gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_BUTTON));

  g_signal_connect (add_button, "clicked",
                    (GCallback) wp_file_open_dialog, data);

  data->wp_rem_button = appearance_capplet_get_widget (data, "wp_rem_button");

  g_signal_connect (data->wp_rem_button, "clicked",
                    (GCallback) wp_remove_wallpaper, data);
  data->screen_monitors_handler = g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (data->wp_view)),
                                                    "monitors-changed",
                                                    G_CALLBACK (screen_monitors_changed),
                                                    data);
  data->screen_size_handler = g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (data->wp_view)),
                                                    "size-changed",
                                                    G_CALLBACK (screen_monitors_changed),
                                                    data);

  g_signal_connect (data->wp_view, "selection-changed",
                    (GCallback) wp_props_wp_selected, data);
  g_signal_connect (data->wp_view, "query-tooltip",
                    (GCallback) wp_view_tooltip_cb, data);
  gtk_widget_set_has_tooltip (GTK_WIDGET (data->wp_view), TRUE);

  wp_set_sensitivities (data);

  /* create the file selector later to save time on startup */
  data->wp_filesel = NULL;

}
Exemplo n.º 9
0
void uploader_curl_file (void **apFilesPaths , int ListCount) {

	void *pChoosedFile = NULL;
	char *FileName = NULL;
	long long FileSize = 0;
	double TotalTime = 0;
	double BatchTotalTime = 0;
	float BatchSize = 0;
	char buff[256];
	bool CancelReq = false;
	int i, UpDone = 0;

	if(access(PathCurlOut, F_OK ) != -1)
		remove(PathCurlOut);
	if(ListCount == 0)
		return;

	BatchLinks = (char*) realloc(BatchLinks,(ListCount*sizeof(RegexMatchURL)));
	if(BatchLinks == NULL)
			log_error(true,"***Error: Memory error @ L62 - pomfit.c");

	for(i = 0 ; i < ListCount; ++i) {

		pChoosedFile = apFilesPaths[i];
		if(pomfit_check_size(pChoosedFile,ActiveProfile.MaxSize) == 1)
			continue;

		CURL *curl;
		CURLcode res;
		struct curl_httppost *post = NULL;
		struct curl_httppost *last = NULL;
		pChoosedFile = apFilesPaths[i];
		FILE *pUploadFile = fopen(pChoosedFile, "rb");
		if(!pUploadFile) {

			log_error(true,"***Error: Uploader failed to read file %s",pChoosedFile);
			pChoosedFile = NULL;
			return;
		} else {

			fseek(pUploadFile, 0 , SEEK_END);
			FileSize = ftell(pUploadFile);
			rewind(pUploadFile);
		}
		FILE *pOutputFile;
		pOutputFile = fopen(PathCurlOut, "a");
		if(!pOutputFile) {

			log_error(true,"***Error: Uploader failed to create output file %s",PathCurlOut);
			if(pUploadFile)
				fclose(pUploadFile);
			return;
		}
		/// Get name from filepath
		#ifdef __linux__
		FileName = strrchr(pChoosedFile, '/');
		#elif _WIN32
		FileName = strrchr(pChoosedFile, '\\');
		#endif
		FileName += 1;
		gtk_button_set_relief(GTK_BUTTON(up_but), GTK_RELIEF_NONE);
		gtk_button_set_label(GTK_BUTTON(up_but), "Cancel");
		IsUploading = TRUE;

		TimeUpStarted = time(NULL);
		curl = curl_easy_init();
		if(curl)
		{
			if(ActiveProfile.bFormName) {
				char *Suffix = strrchr(FileName, '.');
				char CustomFileName[512];
				sprintf(CustomFileName, "%s%s",ActiveProfile.FormFileName,Suffix);
				printf("%s\n",CustomFileName);
				curl_formadd(&post, &last,
					CURLFORM_COPYNAME, ActiveProfile.FormName,
					CURLFORM_FILE, pChoosedFile,
					CURLFORM_FILENAME, CustomFileName,
					CURLFORM_CONTENTTYPE, ActiveProfile.FormType,
					CURLFORM_END);

			} else if (!ActiveProfile.bNames){
				curl_formadd(&post, &last,
					CURLFORM_COPYNAME, ActiveProfile.FormName,
					CURLFORM_FILE, pChoosedFile,
					CURLFORM_FILENAME, "Pomfit_Upload",
					CURLFORM_CONTENTTYPE, ActiveProfile.FormType,
					CURLFORM_END);
			} else {
				curl_formadd(&post, &last,
					CURLFORM_COPYNAME, ActiveProfile.FormName,
					CURLFORM_FILE, pChoosedFile,
					CURLFORM_CONTENTTYPE, ActiveProfile.FormType,
					CURLFORM_END);
			}
			curl_easy_setopt(curl, CURLOPT_URL, ActiveProfile.URL);
			curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
			curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, uploader_curl_progress);
			curl_easy_setopt(curl, CURLOPT_READDATA, pUploadFile);
			curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
                     (curl_off_t)FileSize);
			curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
			curl_easy_setopt(curl, CURLOPT_USERAGENT, POMFIT_USER_AGENT);

			curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
			curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
			curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
			curl_easy_setopt(curl, CURLOPT_WRITEDATA, pOutputFile);
			if(ActiveProfile.bCookie) {
				curl_easy_setopt(curl, CURLOPT_COOKIESESSION, TRUE);
				curl_easy_setopt(curl, CURLOPT_COOKIEJAR, PathCookie);
				curl_easy_setopt(curl, CURLOPT_COOKIEFILE, PathCookie);
			}
			res = curl_easy_perform(curl);
			if(res != CURLE_OK) {

				log_error(true, "***Error: curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
				if(ListCount == 1 || strstr(curl_easy_strerror(res),"aborted") || CancelReq) {

					gtk_statusbar_push(GTK_STATUSBAR(status_bar),
										1,"Uploading canceled.");
					gtk_button_set_relief(GTK_BUTTON(up_but),
											GTK_RELIEF_NORMAL);
					gtk_button_set_label(GTK_BUTTON(up_but), "Upload");
					IsUploading = FALSE;
					pomfit_notify(curl_easy_strerror(res),"Uploading canceled");
					pChoosedFile = NULL;
					if(pUploadFile)
						fclose(pUploadFile);
					if(pOutputFile)
						fclose(pOutputFile);
					curl_formfree(post);
					curl_easy_cleanup(curl);
					if(remove(PathCurlOut) != 0)
                        perror("Error deleting temp file");

					return;
				} else {

                    pChoosedFile = NULL;
					if(pUploadFile)
						fclose(pUploadFile);
					if(pOutputFile)
						fclose(pOutputFile);
					curl_formfree(post);
					curl_easy_cleanup(curl);
					CancelReq = true;
					continue;
                }
			} else {
				fprintf(pOutputFile,"\n");
				BatchSize += (float)FileSize/1000000;;
				UpDone += 1;
			}
			curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &TotalTime);
			curl_formfree(post);
			curl_easy_cleanup(curl);
			BatchTotalTime += TotalTime;
		}
		fclose(pOutputFile);
		if(pUploadFile)
			fclose(pUploadFile);

		if (uploader_curl_output(PathCurlOut,pChoosedFile) == 0) {

			if(i == 0)
				sprintf(BatchLinks,"%s ", RegexMatchURL);
			else
				sprintf(strchr(BatchLinks, '\0'),"%s ", RegexMatchURL);


			RegexMatchURL[0] = '\0';
			RegexMatchDEL[0] = '\0';

		}
	}
	if(UpDone == 0)
		return;
    sprintf(buff, "%d File%s(%.2f MB) in %dmin %dsec",
				UpDone,UpDone < 2 ? "" : "s",BatchSize ,
				(int)BatchTotalTime > 60 ? (int)BatchTotalTime/60 : 0,
				(int)BatchTotalTime%60 > 0 ? (int)BatchTotalTime%60 : 1);
	GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
	gtk_clipboard_set_can_store (clipboard,NULL,0);
	gtk_clipboard_set_text(clipboard, BatchLinks, strlen(BatchLinks)-1);
	gtk_clipboard_store(clipboard);
	gtk_statusbar_push (GTK_STATUSBAR(status_bar), 1, buff);
	sprintf(strchr(buff, '\0'),"\nLink%s copied to clipboard ", UpDone < 2 ? "" : "s");
	pomfit_notify(buff,"Uploading Finished");
	sprintf(buff,"Click to open all links.\nRight click to copy links.");
	gtk_widget_set_tooltip_text(link_but, buff);
	gtk_link_button_set_uri(GTK_LINK_BUTTON(link_but), BatchLinks);
	sprintf(buff,"%d/%d File%s Uploaded",
				UpDone, ListCount, UpDone < 2 ? "" : "s");
	gtk_button_set_label(GTK_BUTTON(link_but), buff);
	gtk_button_set_relief(GTK_BUTTON(up_but), GTK_RELIEF_NORMAL);
	gtk_button_set_label(GTK_BUTTON(up_but), "Upload");
	IsUploading = FALSE;

	pChoosedFile = NULL;
	for(i = 0 ; i < ListCount; ++i)
		apFilesPaths[i] = NULL;

}
void themes_init(AppearanceData* data)
{
  GtkWidget *w, *del_button;
  GList *theme_list, *l;
  GtkListStore *theme_store;
  GtkTreeModel *sort_model;
  MateThemeMetaInfo *meta_theme = NULL;
  GtkIconView *icon_view;
  GtkCellRenderer *renderer;
  GtkSettings *settings;
  char *url;

  /* initialise some stuff */
  mate_theme_init ();
  mate_wm_manager_init ();

  data->revert_application_font = NULL;
  data->revert_documents_font = NULL;
  data->revert_desktop_font = NULL;
  data->revert_windowtitle_font = NULL;
  data->revert_monospace_font = NULL;
  data->theme_save_dialog = NULL;
  data->theme_message_area = NULL;
  data->theme_info_icon = NULL;
  data->theme_error_icon = NULL;
  data->theme_custom = mate_theme_meta_info_new ();
  data->theme_icon = gdk_pixbuf_new_from_file (MATECC_PIXMAP_DIR "/theme-thumbnailing.png", NULL);
  data->theme_store = theme_store =
      gtk_list_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);

  /* set up theme list */
  theme_list = mate_theme_meta_info_find_all ();
  mate_theme_info_register_theme_change ((ThemeChangedCallback) theme_changed_on_disk_cb, data);

  data->theme_custom = theme_load_from_mateconf (data->client);
  data->theme_custom->name = g_strdup (CUSTOM_THEME_NAME);
  data->theme_custom->readable_name = g_strdup_printf ("<i>%s</i>", _("Custom"));

  for (l = theme_list; l; l = l->next) {
    MateThemeMetaInfo *info = l->data;

    gtk_list_store_insert_with_values (theme_store, NULL, 0,
        COL_LABEL, info->readable_name,
        COL_NAME, info->name,
        COL_THUMBNAIL, data->theme_icon,
        -1);

    if (!meta_theme && theme_is_equal (data->theme_custom, info))
      meta_theme = info;
  }

  if (!meta_theme) {
    /* add custom theme */
    meta_theme = data->theme_custom;

    gtk_list_store_insert_with_values (theme_store, NULL, 0,
        COL_LABEL, meta_theme->readable_name,
        COL_NAME, meta_theme->name,
        COL_THUMBNAIL, data->theme_icon,
        -1);

    theme_thumbnail_generate (meta_theme, data);
  }

  theme_list = g_list_sort (theme_list, (GCompareFunc) theme_list_sort_func);

  g_list_foreach (theme_list, (GFunc) theme_thumbnail_generate, data);
  g_list_free (theme_list);

  icon_view = GTK_ICON_VIEW (appearance_capplet_get_widget (data, "theme_list"));

  renderer = gtk_cell_renderer_pixbuf_new ();
  g_object_set (renderer, "xpad", 5, "ypad", 5,
                          "xalign", 0.5, "yalign", 1.0, NULL);
  gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (icon_view), renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (icon_view), renderer,
                                  "pixbuf", COL_THUMBNAIL, NULL);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "alignment", PANGO_ALIGN_CENTER,
			  "wrap-mode", PANGO_WRAP_WORD_CHAR,
			  "wrap-width", gtk_icon_view_get_item_width (icon_view),
			  "width", gtk_icon_view_get_item_width (icon_view),
			  "xalign", 0.0, "yalign", 0.0, NULL);
  gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (icon_view), renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (icon_view), renderer,
                                  "markup", COL_LABEL, NULL);

  sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (theme_store));
  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sort_model), COL_LABEL, theme_store_sort_func, NULL, NULL);
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), COL_LABEL, GTK_SORT_ASCENDING);
  gtk_icon_view_set_model (icon_view, GTK_TREE_MODEL (sort_model));

  g_signal_connect (icon_view, "selection-changed", (GCallback) theme_selection_changed_cb, data);
  g_signal_connect_after (icon_view, "realize", (GCallback) theme_select_name, meta_theme->name);

  w = appearance_capplet_get_widget (data, "theme_install");
  gtk_button_set_image (GTK_BUTTON (w),
                        gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON));
  g_signal_connect (w, "clicked", (GCallback) theme_install_cb, data);

  w = appearance_capplet_get_widget (data, "theme_save");
  gtk_button_set_image (GTK_BUTTON (w),
                        gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_BUTTON));
  g_signal_connect (w, "clicked", (GCallback) theme_save_cb, data);

  w = appearance_capplet_get_widget (data, "theme_custom");
  gtk_button_set_image (GTK_BUTTON (w),
                        gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON));
  g_signal_connect (w, "clicked", (GCallback) theme_custom_cb, data);

  del_button = appearance_capplet_get_widget (data, "theme_delete");
  g_signal_connect (del_button, "clicked", (GCallback) theme_delete_cb, data);

  w = appearance_capplet_get_widget (data, "theme_vbox");
  gtk_drag_dest_set (w, GTK_DEST_DEFAULT_ALL,
		     drop_types, G_N_ELEMENTS (drop_types),
		     GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
  g_signal_connect (w, "drag-data-received", (GCallback) theme_drag_data_received_cb, data);
  if (is_locked_down (data->client))
    gtk_widget_set_sensitive (w, FALSE);

  w = appearance_capplet_get_widget (data, "more_themes_linkbutton");
  url = mateconf_client_get_string (data->client, MORE_THEMES_URL_KEY, NULL);
  if (url != NULL && url[0] != '\0') {
    gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
    gtk_widget_show (w);
  } else {
    gtk_widget_hide (w);
  }
  g_free (url);

  /* listen to mateconf changes, too */
  mateconf_client_add_dir (data->client, "/apps/marco/general", MATECONF_CLIENT_PRELOAD_NONE, NULL);
  mateconf_client_add_dir (data->client, "/desktop/mate/interface", MATECONF_CLIENT_PRELOAD_NONE, NULL);
  mateconf_client_notify_add (data->client, MARCO_THEME_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, CURSOR_THEME_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
#ifdef HAVE_XCURSOR
  mateconf_client_notify_add (data->client, CURSOR_SIZE_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
#endif
  mateconf_client_notify_add (data->client, BACKGROUND_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, APPLICATION_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, DOCUMENTS_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, DESKTOP_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, WINDOWTITLE_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
  mateconf_client_notify_add (data->client, MONOSPACE_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);

  settings = gtk_settings_get_default ();
  g_signal_connect (settings, "notify::gtk-color-scheme", (GCallback) theme_setting_changed_cb, data);
  g_signal_connect (settings, "notify::gtk-theme-name", (GCallback) theme_setting_changed_cb, data);
  g_signal_connect (settings, "notify::gtk-icon-theme-name", (GCallback) theme_setting_changed_cb, data);

  /* monitor individual font choice buttons, so
     "revert font" option (if any) can be cleared */
  w = appearance_capplet_get_widget (data, "application_font");
  g_signal_connect (w, "font_set", (GCallback) custom_font_cb, data);
  w = appearance_capplet_get_widget (data, "document_font");
  g_signal_connect (w, "font_set", (GCallback) custom_font_cb, data);
  w = appearance_capplet_get_widget (data, "desktop_font");
  g_signal_connect (w, "font_set", (GCallback) custom_font_cb, data);
  w = appearance_capplet_get_widget (data, "window_title_font");
  g_signal_connect (w, "font_set", (GCallback) custom_font_cb, data);
  w = appearance_capplet_get_widget (data, "monospace_font");
  g_signal_connect (w, "font_set", (GCallback) custom_font_cb, data);
}