* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
_gtk_recent_chooser_install_properties (gobject_class);
/**
- * GtkRecentChooserMenu:show-numbers
+ * GtkRecentChooserMenu:show-numbers:
*
* Whether the first ten items in the menu should be prepended by
* a number acting as a unique mnemonic.
static void
gtk_recent_chooser_menu_select_all (GtkRecentChooser *chooser)
{
- g_warning (_("This function is not implemented for "
- "widgets of class '%s'"),
+ g_warning ("This function is not implemented for "
+ "widgets of class '%s'",
g_type_name (G_OBJECT_TYPE (chooser)));
}
static void
gtk_recent_chooser_menu_unselect_all (GtkRecentChooser *chooser)
{
- g_warning (_("This function is not implemented for "
- "widgets of class '%s'"),
+ g_warning ("This function is not implemented for "
+ "widgets of class '%s'",
g_type_name (G_OBJECT_TYPE (chooser)));
}
GtkWidget *placeholder;
} MenuPopulateData;
+static MenuPopulateData *
+create_menu_populate_data (GtkRecentChooserMenu *menu)
+{
+ MenuPopulateData *pdata;
+
+ pdata = g_slice_new (MenuPopulateData);
+ pdata->items = NULL;
+ pdata->n_items = 0;
+ pdata->loaded_items = 0;
+ pdata->displayed_items = 0;
+ pdata->menu = menu;
+ pdata->placeholder = g_object_ref (menu->priv->placeholder);
+
+ return pdata;
+}
+
+static void
+free_menu_populate_data (MenuPopulateData *pdata)
+{
+ if (pdata->placeholder)
+ g_object_unref (pdata->placeholder);
+ g_slice_free (MenuPopulateData, pdata);
+}
+
static gboolean
idle_populate_func (gpointer data)
{
if (pdata->loaded_items == pdata->n_items)
{
- g_list_foreach (pdata->items, (GFunc) gtk_recent_info_unref, NULL);
- g_list_free (pdata->items);
+ g_list_free_full (pdata->items, (GDestroyNotify) gtk_recent_info_unref);
priv->populate_id = 0;
*/
if (!pdata->displayed_items)
gtk_widget_show (pdata->placeholder);
- g_object_unref (pdata->placeholder);
-
- g_slice_free (MenuPopulateData, data);
}
+
+ free_menu_populate_data (pdata);
}
static void
MenuPopulateData *pdata;
GtkRecentChooserMenuPrivate *priv = menu->priv;
- if (menu->priv->populate_id)
+ if (priv->populate_id)
return;
- pdata = g_slice_new (MenuPopulateData);
- pdata->items = NULL;
- pdata->n_items = 0;
- pdata->loaded_items = 0;
- pdata->displayed_items = 0;
- pdata->menu = menu;
- pdata->placeholder = g_object_ref (priv->placeholder);
+ pdata = create_menu_populate_data (menu);
/* remove our menu items first */
gtk_recent_chooser_menu_dispose_items (menu);
-
+
priv->populate_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
idle_populate_func,
pdata,