Beispiel #1
0
/**
 * gimp_session_info_get_info_with_widget:
 * @info:
 * @widget: #GtkWidget to use
 *
 * Temporarily sets @widget on @info and calls
 * gimp_session_info_get_info(), then restores the old widget that was
 * set.
 **/
void
gimp_session_info_get_info_with_widget (GimpSessionInfo *info,
                                        GtkWidget       *widget)
{
  GtkWidget *old_widget;

  g_return_if_fail (GIMP_IS_SESSION_INFO (info));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  old_widget = gimp_session_info_get_widget (info);

  gimp_session_info_set_widget (info, widget);
  gimp_session_info_get_info (info);
  gimp_session_info_set_widget (info, old_widget);
}
Beispiel #2
0
static void
gimp_dialog_factories_save_foreach (gconstpointer      key,
                                    GimpDialogFactory *factory,
                                    GimpConfigWriter  *writer)
{
  GList *infos;

  for (infos = factory->session_infos; infos; infos = g_list_next (infos))
    {
      GimpSessionInfo *info = infos->data;

      /*  we keep session info entries for all toplevel dialogs created
       *  by the factory but don't save them if they don't want to be
       *  managed
       */
      if (info->dockable_entry ||
          (info->toplevel_entry && ! info->toplevel_entry->session_managed))
        continue;

      if (info->widget)
        gimp_session_info_get_info (info);

      gimp_config_writer_open (writer, "session-info");
      gimp_config_writer_string (writer,
                                 gimp_object_get_name (GIMP_OBJECT (factory)));
      gimp_config_writer_string (writer,
                                 info->toplevel_entry ?
                                 info->toplevel_entry->identifier :
                                 "dock");

      GIMP_CONFIG_GET_INTERFACE (info)->serialize (GIMP_CONFIG (info),
                                                   writer,
                                                   NULL);

      gimp_config_writer_close (writer);

      if (info->widget)
        gimp_session_info_clear_info (info);
    }
}